[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: This is indeed interesting. For what it's worth, I think the Python 3.0 behaviour is the right one, here. Perhaps it's worth adding a test to Python 3.0 to make sure that this behaviour doesn't accidentally disappear, or at least to make sur

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: [Raymond] > assuming basic invariants. In 2.6, all of the following are always > true: > > assert a in [a] > assert a in (a,) > assert a in set([a]) > assert [a].count(a) == 1 And these are all still true in 3.0 as well, aren't they?

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: To be clear, I'm saying that PyObject_RichCompareBool() needs to add-back the code: /* Quick result when objects are the same. Guarantees that identity implies equality. */ if (v == w) { if (op ==

[issue4298] pickle segfault or MemoryError on invalid input

2008-11-11 Thread Hagen Fürstenau
New submission from Hagen Fürstenau <[EMAIL PROTECTED]>: On a 64-bit build pickle.loads segfaults on the following bytes. (Same for pickle.load on a corresponding file.) On a 32-bit build there is only a MemoryError. Python 3.0rc2 (r30rc2:67114, Nov 10 2008, 12:09:54) [GCC 4.1.2 20070925 (Red Ha

[issue4299] 3.0rc2.msi Install Fails (Error Code 2755)

2008-11-11 Thread Gary VanHorn
New submission from Gary VanHorn <[EMAIL PROTECTED]>: Where can an error code resource be found? -- components: Installation messages: 75744 nosy: sharksuit severity: normal status: open title: 3.0rc2.msi Install Fails (Error Code 2755) versions: Python 3.0 _

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Michael B Curtis
Michael B Curtis <[EMAIL PROTECTED]> added the comment: All, Thank you for your rigorous analysis of this bug. To answer the question of the impact of this bug: the real issue that caused problems for our application was Python deciding to silently cast NaN falues to 0L, as discussed here: htt

[issue4258] Use 30-bit digits instead of 15-bit digits for Python integers.

2008-11-11 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: Here's a version of the 15-bit to 30-bit patch that adds in a souped-up version of Mario Pernici's faster multiplication. I did some testing of 100x100 digit and 1000x1000 digit multiplies. On 32-bit x86: 100 x 100 digits : around 2.5 tim

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: The issue with nan -> 0L was fixed in Python 2.6. I can't recall if I fixed it or somebody else but I know it was discussed. $ python2.6 >>> long(float("nan")) Traceback (most recent call last): File "", line 1, in ValueError: cannot con

[issue4294] Macros for PyLong: sign, number of digits, fits in an int

2008-11-11 Thread Gregory P. Smith
Gregory P. Smith <[EMAIL PROTECTED]> added the comment: I agree with Christian that we should wait until 3.0 is out. Using A DVCS should make this much easier if anyone needs an excuse to learn bzr. I think we should aim to commit the 30bit change (a pretty clear win by the looks of things) aft

[issue3439] create a numbits() method for int and long types

2008-11-11 Thread STINNER Victor
STINNER Victor <[EMAIL PROTECTED]> added the comment: > (-maxint-1).numbits() hangs Ooops, nice catch! It was an integer overflow, already present in fredrikj's original patch. The new patch fixes this bug but also included a documentation patch ;-) Added file: http://bugs.python.org/file1198

[issue3439] create a numbits() method for int and long types

2008-11-11 Thread STINNER Victor
Changes by STINNER Victor <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file11939/numbits-2.diff ___ Python tracker <[EMAIL PROTECTED]> ___

[issue1673409] datetime module missing some important methods

2008-11-11 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: Chris> I keep needing to know the number of seconds that a timedelta Chris> represents. I propose an alternative approach that I believe will neatly solve fractional vs. whole seconds and multitude of conceivable toxxx methods: Let's

[issue4300] error in multiprocessing logging docs

2008-11-11 Thread Brian D'Urso
New submission from Brian D'Urso <[EMAIL PROTECTED]>: the 2.6 docs for the multiprocessing module have a minor error in the logging example which causes it to fail: the documentation says to get the logger with 'multiprocessing.get_logger()' which works but the example uses 'multiprocessing.get

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: Mark, thanks for checking that all the tests still pass. Please do add back the missing lines in PyObject_RichCompareBool(). It seems that their removal was not a necessary part of eliminating default sort-ordering. _

[issue4301] incorrect and inconsistent logging in multiprocessing

2008-11-11 Thread Brian D'Urso
New submission from Brian D'Urso <[EMAIL PROTECTED]>: logging in multiprocessing seems to give inconsistent results on Linux and XP, but neither appears to match the documentation: According to the docs, when first created "the logger has level logging.NOTSET and has a handler which sends output

[issue4298] pickle segfault or MemoryError on invalid input

2008-11-11 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: Fixed in r67187. Thanks for the report, and for the patch! -- nosy: +amaury.forgeotdarc resolution: -> fixed status: open -> closed ___ Python tracker <[EMAIL PROTECTED]>

[issue4185] re module treats raw strings as normal strings

2008-11-11 Thread A.M. Kuchling
Changes by A.M. Kuchling <[EMAIL PROTECTED]>: -- nosy: +akuchling ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list mailin

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: > Taking it out probably had something to do with NaNs, but this > discussion needs to avoid getting lost in NaN paradoxes and instead > focus on a notion of membership that is ALWAYS true given object > identity. This is an essential pragmat

[issue4297] Add error_log attribute to optparse.OptionParser

2008-11-11 Thread Daniel Watkins
New submission from Daniel Watkins <[EMAIL PROTECTED]>: I've recently had to subclass optparse.OptionParser, and copy-paste the exit method, just to change where errors were printed to (I needed stdout rather than stderr). I've also had a request from a client to log errors with command-line par

[issue3439] create a numbits() method for int and long types

2008-11-11 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: Hi, Victor! Thanks for the updated patch. Your patch still hangs on: >>> from sys import maxint >>> (-maxint-1).numbits() on my 32-bit machine. ___ Python tracker <[EMAIL PROTECTED]>

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: (Comment for Michael, everybody else can safely ignore it. Instead of writing: if isinstance(x, list) or isinstance(x, tuple) or isinstance(x, set): you can write: if isinstance(x, (list, tuple, set)): or even better: if hasat

[issue4185] re module treats raw strings as normal strings

2008-11-11 Thread A.M. Kuchling
A.M. Kuchling <[EMAIL PROTECTED]> added the comment: Re-opening as a documentation bug; we should at least make the re.sub docstring match the text documentation. -- assignee: -> akuchling resolution: invalid -> status: closed -> open ___ Python tra

[issue4298] pickle segfault or MemoryError on invalid input

2008-11-11 Thread Hirokazu Yamamoto
Hirokazu Yamamoto <[EMAIL PROTECTED]> added the comment: See trunk/Modules/cPickle.c(609). static Py_ssize_t read_cStringIO(Unpicklerobject *self, char **s, Py_ssize_t n) { char *ptr; if (PycStringIO->cread((PyObject *)self->file, &ptr, n) != n) { PyErr_SetNone(

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: Here is a tes case for 3.0 -- keywords: +patch Added file: http://bugs.python.org/file11984/issue4296_test.patch ___ Python tracker <[EMAIL PROTECTED]>

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: One more data point: in both 2.x and 3.x, sets behave like the 2.x lists: Python 3.0rc2+ (py3k:67177M, Nov 10 2008, 16:06:34) [GCC 4.0.1 (Apple Inc. build 5488)] on darwin Type "help", "copyright", "credits" or "license" for more informati

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: I'm not happy with the 3.0 change. IMO, the best behavior is the one that allows code reviewers to correctly reason about the code by assuming basic invariants. In 2.6, all of the following are always true: assert a in [a] assert a

[issue4297] Add error_log attribute to optparse.OptionParser

2008-11-11 Thread Raghuram Devarakonda
Changes by Raghuram Devarakonda <[EMAIL PROTECTED]>: -- nosy: +draghuram ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: Here's a patch incorporating Christian's tests, the missing lines from PyObject_RichCompareBool, and some additional tests to check that [x] == [x] and the like remain True even when x is a NaN. Oh, and a Misc/NEWS entry. With this patch,

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: Oh h... Raymond, you are so right! I was too tired to think of all implications related to the different semantic in 3.0, especially the for in / is in invariant. I'm including Guido and Barry into the discussion. This topic needs some atten

[issue4301] incorrect and inconsistent logging in multiprocessing

2008-11-11 Thread Benjamin Peterson
Changes by Benjamin Peterson <[EMAIL PROTECTED]>: -- assignee: -> jnoller nosy: +jnoller ___ Python tracker <[EMAIL PROTECTED]> ___ ___

[issue4300] error in multiprocessing logging docs

2008-11-11 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: Thanks for the report! Fixed in r67189. -- nosy: +benjamin.peterson resolution: -> fixed status: open -> closed ___ Python tracker <[EMAIL PROTECTED]> ___

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: The tests are passing on Ubuntu Linux 64bit, too. Good work everybody! -- assignee: gvanrossum -> barry stage: test needed -> patch review ___ Python tracker <[EMAIL PROTECTED]>

[issue3944] faster long multiplication

2008-11-11 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: See issue 4258 for a patch that combines 30-bit digits with this multiplication optimization. The code is quite different from the patch posted here, but the basic idea is the same. ___ Python tracker <[EMA

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: With the lines Raymond mentions restored, all tests (including the extra tests Christian's posted here) pass for me, and I also get: >>> a = [float('nan')] >>> a == a True Incidentally, it looks as though the PyObject_RichCompareBool lines

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: [Michael] > the real issue that caused problems [...] was Python deciding to > silently cast NaN falues to 0L > [...] > it sounds like there is no intention to fix this for versions prior > to 3.0, Oh, ! Guido's message does indeed say tha

[issue3705] py3k fails under Windows if "-c" or "-m" is given a non-ascii value

2008-11-11 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: Raising to release blocker, just to trigger another review... -- priority: critical -> release blocker ___ Python tracker <[EMAIL PROTECTED]> __

[issue3705] py3k fails under Windows if "-c" or "-m" is given a non-ascii value

2008-11-11 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: Go ahead. -- keywords: -needs review ___ Python tracker <[EMAIL PROTECTED]> ___ __

[issue1675] Race condition in os.makedirs

2008-11-11 Thread Zooko O'Whielacronx
Zooko O'Whielacronx <[EMAIL PROTECTED]> added the comment: Here's the version of this that I've been using for almost a decade now: http://allmydata.org/trac/pyutil/browser/pyutil/pyutil/fileutil.py?rev=127#L241 Actually I used to have a bigger version that could optionally require certain thin

[issue3439] create a numbits() method for int and long types

2008-11-11 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: The latest patch from Victor looks good. A few comments: (1) the number of bits should be computed first directly using C arithmetic, and only recomputed using PyLong arithmetic if the C computations overflow. For one thing, overflow is g

[issue3705] py3k fails under Windows if "-c" or "-m" is given a non-ascii value

2008-11-11 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: Fixed as r67190. Thanks for the review. -- resolution: -> fixed status: open -> closed ___ Python tracker <[EMAIL PROTECTED]> _

[issue1328851] pclose raises spurious exception on win32

2008-11-11 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: The subprocess module does return the correct exit code. It should be used instead. -- nosy: +amaury.forgeotdarc resolution: -> wont fix status: open -> closed ___ Python tracker <[EMAIL PRO

[issue1685] linecache .updatecache fails on utf8 encoded files

2008-11-11 Thread Amaury Forgeot d'Arc
Changes by Amaury Forgeot d'Arc <[EMAIL PROTECTED]>: ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue3439] create a numbits() method for int and long types

2008-11-11 Thread Fredrik Johansson
Fredrik Johansson <[EMAIL PROTECTED]> added the comment: In stdtypes.rst, x.numbits should be listed in the table under "Bit-string Operations on Integer Types" and not in the table of operations supported by all numeric types. > (1) the number of bits should be computed first directly using C

[issue3439] create a numbits() method for int and long types

2008-11-11 Thread STINNER Victor
STINNER Victor <[EMAIL PROTECTED]> added the comment: [Mark Dickinson] > (1) the number of bits should be computed first directly using ... _PyLong_NumBits() : done. But the result type is always long. > (2) Just as a matter of style, I think "if (x == NULL)" is preferable done > (4) I quite

[issue3100] weakref subclass segfault

2008-11-11 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: This was fixed 4 months ago with r64309 (trunk, 2.6) and r64310 (2.5). -- resolution: -> fixed status: open -> closed ___ Python tracker <[EMAIL PROTECTED]>

[issue4296] Python assumes identity implies equivalence; contradicts NaN

2008-11-11 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: Mark, the patch looks good. Thanks. Before committing, please add one other test that verifies the relationship between "in" in membership tests and "in" in a for-loop: for constructor in list, tuple, dict.fromkeys, set, collections.deq

[issue1471243] Visual Studio 2005 CRT error handler

2008-11-11 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: Already implemented, since r47223. -- nosy: +amaury.forgeotdarc resolution: -> out of date status: open -> closed ___ Python tracker <[EMAIL PROTECTED]>

[issue2971] test_zipfile64 fails

2008-11-11 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: Fixed with r67194. Note that the test is now always skipped: too big! -- nosy: +amaury.forgeotdarc resolution: -> fixed status: open -> closed ___ Python tracker <[EMAIL PROTECTED]>

[issue4079] new urllib2.Request 'timeout' attribute needs to have a default

2008-11-11 Thread Senthil
Senthil <[EMAIL PROTECTED]> added the comment: http://bugs.python.org/issue4079 -- nosy: +orsenthil ___ Python tracker <[EMAIL PROTECTED]> ___ _