[issue14719] Lists: [[0]*N]*N != [[0 for _ in range(N)] for __ in range(N)]
Yuval Greenfield ubershme...@gmail.com added the comment: This isn't a bug and should be closed. It's more of a stack overflow question. If you'd like to change this fundamental behavior of a very common operation in python you should make a proposal to the python ideas mailing list at http://mail.python.org/mailman/listinfo/python-ideas In your example board_2 is equivalent to: row = [0] * N board_2 = row * N All the rows are the same initial row. As opposed to board_1 where each row is a new row. Try this: [id(i) for i in board_2] The initial equivalence is because they do represent the same values (NxN list of all zeroes). What should python compare if not by values? -- nosy: +ubershmekel ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14719 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14719] Lists: [[0]*N]*N != [[0 for _ in range(N)] for __ in range(N)]
Martin v. Löwis mar...@v.loewis.de added the comment: It's actually fairly easy to explain. Just think about it harder (and consider Yuval's explanation). -- nosy: +loewis resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14719 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds
Larry Hastings la...@hastings.org added the comment: bba131e48852 causes crashes on Windows. The attached patch fixes the crash and makes test_os pass for me. However, using PyErr_ExceptionMatches(PyExc_RuntimeError) to check whether to try again using narrow strings is ugly. Maybe utime_read_time_arguments() should be changed to have three possible return values. I appreciate the feedback, and the patch. And I agree--we should be able to find a better fix than that particular band-aid. Can we hold off on checking in a patch for now? TBH I don't understand why it should crash, and therefore how your patch helps. Trying again using narrow strings should always work; indeed, the code did that before I touched it. Can you describe how it crashes? (p.s. Considering that I can't test on Windows myself, I'm pretty happy that the code works as well as it does!) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14720] sqlite3 microseconds
New submission from Frank Millman fr...@chagford.com: sqlite3/dbapi2.py contains the following - def convert_timestamp(val): datepart, timepart = val.split(b ) timepart_full = timepart.split(b.) [...] if len(timepart_full) == 2: microseconds = int(timepart_full[1]) else: microseconds = 0 It assumes that 'timepart_full[1]' is a string containing 6 digits. I have a situation where the string containing 3 digits, so it gives the wrong result. For example, if the string is '456', this represents 456000 microseconds, but sqlite3 returns 456 microseconds. I think that it should right-zero-fill the string to 6 digits before converting to an int, like this - microseconds = int('{:06}'.format(timepart_full[1])) -- components: Library (Lib) messages: 159905 nosy: frankmillman priority: normal severity: normal status: open title: sqlite3 microseconds type: behavior versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14720 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14719] Lists: [[0]*N]*N != [[0 for _ in range(N)] for __ in range(N)]
Ezio Melotti ezio.melo...@gmail.com added the comment: http://docs.python.org/faq/programming.html#how-do-i-create-a-multidimensional-list http://python.net/crew/mwh/hacks/objectthink.html -- nosy: +ezio.melotti stage: - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14719 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14654] Faster utf-8 decoding
Serhiy Storchaka storch...@gmail.com added the comment: title: More fast utf-8 decoding - Faster utf-8 decoding Éric, there is already an issue (#4868) with this title. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14654 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14654] Faster utf-8 decoding
Martin v. Löwis mar...@v.loewis.de added the comment: There is nothing wrong with two issues having the same title. Of course, it would be best if the title reflected the *actual* defect or change, such as specialize UTF-8 decoding by character width, or some such. In any case, the title change is desirable since the original title was ungrammatical. If you wanted to point out that this really is an augmented, escalated rise, then Even faster utf-8 decoded, amazingly faster UTF-8 decoding, or unbelievably faster utf-8 decoding could have worked :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14654 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds
Richard Oudkerk shibt...@gmail.com added the comment: TBH I don't understand why it should crash, and therefore how your patch helps. Trying again using narrow strings should always work; indeed, the code did that before I touched it. Can you describe how it crashes? The important part of the patch is the removal of the ! in if (!utime_read_time_arguments(ua)) { Without that change, if utime_read_time_arguments(ua) fails then the unicode path is wrongly chosen. Then PyUnicode_AsUnicode(upath) is called when upath has not been initialized. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14654] Faster utf-8 decoding
Serhiy Storchaka storch...@gmail.com added the comment: Thank you, Martin, this is what I had in mind. Lost in translation. ;) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14654 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds
Richard Oudkerk shibt...@gmail.com added the comment: Without the check for RuntimeError os.utime(foo, times=(5,5), ns=(5,5)) raises TypeError(TypeError: 'str' does not support the buffer interface) because we have fallen through to the narrow path. The correct error is RuntimeError(utime: you may specify either 'times' or 'ns' but not both) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds
Larry Hastings la...@hastings.org added the comment: Let me recap, just to make sure I have it straight. There are two errors on Windows: * The ! on (what is currently) line 3770 is wrong: if (!utime_read_time_arguments(ua)) { * If you pass in a Unicode string but also pass in both times and ns, you get the wrong error: effectively it's complaining that the string is not narrow, when it should be complaining about having both times and ns. For the former, obviously removing the ! is correct. But I like your idea of making the utime_read_time_argument() return value tell you what happened; that's what the Windows code needs to know. So here it is! Please see the attached patch. -- Added file: http://bugs.python.org/file25451/larry.utime.win32.bugfix.1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds
Richard Oudkerk shibt...@gmail.com added the comment: Let me recap, just to make sure I have it straight. There are two errors on Windows: That's right. The patch looks good and passes for me on Windows. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset fc5d2f4291ac by Larry Hastings in branch 'default': Issue #14127: Fix two bugs with the Windows implementation. http://hg.python.org/cpython/rev/fc5d2f4291ac -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
New submission from Arve Knudsen arve.knud...@gmail.com: httplib doesn't specify the HTTP header 'content-length' for POST requests without data. Conceptually this makes sense, considering the empty content. However, IIS (7.5) servers don't accept such requests and respond with a 411 status code. See this question on StackOverflow for reference: http://stackoverflow.com/questions/5915131/can-i-send-an-empty-http-post-webrequest-object-from-c-sharp-to-iis. See also issue #223 of the Requests project, https://github.com/kennethreitz/requests/issues/223, which regards this problem in the context of the requests Python library. The following code makes a data-less POST request to the HTTP sniffer Fiddler running on localhost: import httplib conn = httplib.HTTPConnection(localhost, ) conn.request(POST, /post, , {}) conn.close() Fiddler reports that it receives the following headers for the POST request, as you can see 'content-length' is not included: POST http://localhost:/post HTTP/1.1 Host: localhost: Accept-Encoding: identity -- components: Library (Lib) messages: 159915 nosy: Arve.Knudsen priority: normal severity: normal status: open title: httplib doesn't specify content-length header for POST requests without data versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14705] Add 'bool' format character to PyArg_ParseTuple*
Eric V. Smith e...@trueblade.com added the comment: The patch looks good to me. Are there any places in the current code base that would use P? p seems the more useful case. Are you planning on changing existing code to use P or p, or just use it going forward? -- nosy: +eric.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14572] 2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4
Marc-Andre Lemburg m...@egenix.com added the comment: Mac OS X 10.4 is also affected and for the same reason. SQLite builds fine for Python 2.5 and 2.6, but not for 2.7. -- nosy: +lemburg title: 2.7.3: sqlite module does not build on centos 5 - 2.7.3: sqlite module does not build on centos 5 and Mac OS X 10.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14572 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14705] Add 'bool' format character to PyArg_ParseTuple*
Mark Dickinson dicki...@gmail.com added the comment: I also think that 'P' looks too strict to be really useful. I can't think of too many cases where I'd really want to insist on a boolean argument (and reject values of 0 or 1). Maybe implement just 'p' for now and consider 'P' later? -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds
Richard Oudkerk shibt...@gmail.com added the comment: There is another problem causing a fatal error in test_posix on Unix. The attached patch fixes it: *ua-path should be decrefed not ua-path. -- Added file: http://bugs.python.org/file25452/utime_read_time_arguments.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds
Larry Hastings la...@hastings.org added the comment: Looks good to me. You're a core contributor, yes? If not let me know and I'll commit it. Though I must admit I'm baffled how I haven't seen that crash. I've run the unit tests a zillion times on this patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds
Richard Oudkerk shibt...@gmail.com added the comment: Looks good to me. You're a core contributor, yes? If not let me know and I'll commit it. I will commit. Though I must admit I'm baffled how I haven't seen that crash. I've run the unit tests a zillion times on this patch. Were you running test_posix or only test_os? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds
Larry Hastings la...@hastings.org added the comment: By the unit tests I meant I ran the whole suite: Lib/test/regrtest.py. I know that runs test_os, and I assume it runs test_posix too. I just ran test_posix by hand and it passed. I'm developing on Linux (64-bit) in case that helps. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14705] Add 'bool' format character to PyArg_ParseTuple*
Larry Hastings la...@hastings.org added the comment: I looked through the Python sources and couldn't find any instances of a function or method with an argument that only allowed you to pass in either True or False. Serily already said he would use 'P' over 'p', although I too am unconvinced that's a good idea. Serily: why would you unhesitatingly prefer 'P' to 'p'? Certainly I see loads of uses for 'p'. For example, when converting code from Python to C that already relied on Python's standard definition of truthiness. I did find some spots that took an object and converted to bool with PyObject_IsTrue, like _json.Encoder(allow_nan) and pickle._Pickler(fix_imports). These too would be well-served by 'p'. I also found some funny in-between cases. For example, stat_float_times and the three-argument form of os.symlink both claim to take a boolean but actually take 'i' (integer). This is relying on bool.__int__(). We certainly couldn't use 'P' here. We could consider switching these to 'p', though in all likelyhood we'll just leave 'em alone. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds
Richard Oudkerk shibt...@gmail.com added the comment: I'm developing on Linux (64-bit) in case that helps. I tested it on 32 bit Linux. I have committed it, but I forgot to put the issue number in the commit message. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14127] add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds
Martin v. Löwis mar...@v.loewis.de added the comment: Revision 4deb7c1f49b9 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14705] Add 'bool' format character to PyArg_ParseTuple*
Martin v. Löwis mar...@v.loewis.de added the comment: I think there should be a test case also where PyObject_IsTrue gives an exception (which I think can happen if __bool__ raises an exception). -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14705] Add 'bool' format character to PyArg_ParseTuple*
Larry Hastings la...@hastings.org added the comment: I think there should be a test case also where PyObject_IsTrue gives an exception (which I think can happen if __bool__ raises an exception). I'd be happy to add such a test, but I don't know of any types like that. Can anyone suggest one? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14705] Add 'bool' format character to PyArg_ParseTuple*
Martin v. Löwis mar...@v.loewis.de added the comment: I think there should be a test case also where PyObject_IsTrue gives an exception (which I think can happen if __bool__ raises an exception). I'd be happy to add such a test, but I don't know of any types like that. Can anyone suggest one? class NotTrue: def __bool__(self): raise NotImplementedError -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14705] Add 'bool' format character to PyArg_ParseTuple*
Larry Hastings la...@hastings.org added the comment: Added test forcing a failure for 'p' (and 'P'). This made me have to handle errors a little differently, so it was definitely good to test it. Thanks for the suggestion, Martin! Also changed wording in documentation ever-so-slightly. -- Added file: http://bugs.python.org/file25453/larry.parse.tuple.p.and.P.2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14705] Add 'bool' format character to PyArg_ParseTuple*
Eric V. Smith e...@trueblade.com added the comment: Now that I think about this some more, I think I'd structure the 'p' tests as: for expr in [False, None, True, 1, 0]: # add the rest self.assertEqual(bool(expr), getargs_p(expr)) Since the salient point is that 'p' returns the same value as bool(), right? And for the one that raises an exception, you'll have to check that bool and getargs_p both raise the same type of exception. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14705] Add 'bool' format character to PyArg_ParseTuple*
Serhiy Storchaka storch...@gmail.com added the comment: Serily: why would you unhesitatingly prefer 'P' to 'p'? My name is Serhiy. :) 'P' has the advantage that you can safely backward-compatibly remove the restriction by replacing 'P' on 'p'. :) I also found some funny in-between cases. This is historical legacy, some still use 1/0 instead True/False. In the end, bool subclasses int. But we have no middlecase for latin 'P'. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14720] sqlite3 microseconds
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +ghaering versions: +Python 2.7, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14720 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14705] Add 'bool' format character to PyArg_ParseTuple*
Serhiy Storchaka storch...@gmail.com added the comment: Since the salient point is that 'p' returns the same value as bool(), right? Yes, and bool_new() is a candidate number one for using new feature. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14705] Add 'bool' format character to PyArg_ParseTuple*
Eric V. Smith e...@trueblade.com added the comment: If bool_new() is going to use 'p', then my suggestion shouldn't be the only test of 'p'. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14705] Add 'bool' format character to PyArg_ParseTuple*
Mark Dickinson dicki...@gmail.com added the comment: In this line in the patch (Python/getargs.c): +if (val == -1 || PyErr_Occurred()) { Isn't that call to PyErr_Occurred() redundant? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
Jesús Cea Avión j...@jcea.es added the comment: Could you provide a patch? Does this affect 3.x too? -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti stage: - test needed type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
Arve Knudsen arve.knud...@gmail.com added the comment: I can look into patch and 3.x tonight I think. Should I provide a test with an eventual patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14722] Overflow in parsing 'float' parameters in PyArg_ParseTuple*
New submission from Serhiy Storchaka storch...@gmail.com: In function convertsimple() in Python/getargs.c possible converting out of float range value from double to float. Fortunately, 'f' format character is not used in CPython source code. But it can be used in the extensions. Tests will be later. -- components: Interpreter Core files: getargs_float_overflow.patch keywords: patch messages: 159937 nosy: storchaka priority: normal severity: normal status: open title: Overflow in parsing 'float' parameters in PyArg_ParseTuple* versions: Python 2.7, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file25454/getargs_float_overflow.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14722 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
Jesús Cea Avión j...@jcea.es added the comment: Patch with test, please :-). I know it is a pain in the ass, but the result is having a higher quality python. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14722] Overflow in parsing 'float' parameters in PyArg_ParseTuple*
Mark Dickinson dicki...@gmail.com added the comment: I don't think this change should be made for 2.7 or 3.2, since it has potential to break existing code. Though technically, conversion of an out-of-range double to a float gives undefined behaviour (C99 6.3.1.5p2), I'm willing to bet that most current compilers just happily return +-infinity in these cases, and there's probably code out there that would break if we changed this. So for 2.7 or 3.2, we could just return +-inf here instead. Though even that isn't quite right if you're picky about corner cases, since there are some values *just* outside [-FLOAT_MAX, FLOAT_MAX] that should still round to +-FLOAT_MAX under round-to-nearest. I suggest leaving this alone for 2.7 and 3.2 For 3.3, it's not clear to me whether it's better to return +-inf or to raise here. -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14722 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14722] Overflow in parsing 'float' parameters in PyArg_ParseTuple*
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14722 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14722] Overflow in parsing 'float' parameters in PyArg_ParseTuple*
Mark Dickinson dicki...@gmail.com added the comment: I was just remembering that I was *sure* I'd seen the double-float avoiding undefined behaviour issue mentioned on a C mailing list not so long ago. Turns out that there was a good reason for me remembering that... https://groups.google.com/group/comp.lang.c/browse_thread/thread/5d93cc742025b298 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14722 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14722] Overflow in parsing 'float' parameters in PyArg_ParseTuple*
Changes by Mark Dickinson dicki...@gmail.com: -- assignee: - mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14722 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +orsenthil stage: test needed - needs patch versions: +Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14720] sqlite3 microseconds
Antoine Pitrou pit...@free.fr added the comment: Can be reproduced with: con = sqlite3.connect(:memory:, detect_types=sqlite3.PARSE_DECLTYPES) cur = con.cursor() cur.execute(CREATE TABLE t (x TIMESTAMP)) sqlite3.Cursor object at 0x7f90a4f69ea0 cur.execute(INSERT INTO t (x) VALUES ('2012-04-04 15:06:00.456')) sqlite3.Cursor object at 0x7f90a4f69ea0 cur.execute(SELECT * FROM t) sqlite3.Cursor object at 0x7f90a4f69ea0 cur.fetchall() [(datetime.datetime(2012, 4, 4, 15, 6, 0, 456),)] -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14720 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
Piotr Dobrogost p...@bugs.python.dobrogost.net added the comment: Fiddler reports that it receives the following headers for the POST request Python 3.2.3 on Windows Vista 64bit gives the same output for import http.client conn = http.client.HTTPConnection('localhost',) conn.request(POST, /post, , {}) conn.close() -- nosy: +piotr.dobrogost ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14710] pkgutil.get_loader is broken
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14710 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14093] Mercurial version information not appearing in Windows builds
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: I'd like to commit this soon. Any chance of a review? It's a very small patch, so it shouldn't need much time. -- keywords: +needs review -patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14093 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14654] Faster utf-8 decoding
Antoine Pitrou pit...@free.fr added the comment: 64-bit Linux, Intel Core i5-2500K CPU @ 3.30GHz: vanilla 3.3 patch 2 patch 3 utf-8 'A'*1 6931 (+3%)7115 (+0%) 7117 utf-8 'A'*+'\x80' 2347 (+1%)2410 (-2%) 2360 utf-8 'A'*+'\u0100' 2279 (+1%)2282 (+1%) 2310 utf-8 'A'*+'\u8000' 2264 (+2%)2275 (+1%) 2300 utf-8 'A'*+'\U0001' 2351 (+0%)2283 (+3%) 2359 utf-8 '\x80'*1516 (+8%) 558 (+0%) 559 utf-8 '\x80'+'A'* 859 (+0%) 868 (-1%) 860 utf-8 '\x80'*+'\u0100'526 (+6%) 558 (+0%) 558 utf-8 '\x80'*+'\u8000'535 (+4%) 558 (+0%) 558 utf-8 '\x80'*+'\U0001'525 (+6%) 559 (-0%) 558 utf-8 '\u0100'*1 517 (+6%) 548 (+0%) 548 utf-8 '\u0100'+'A'* 818 (+0%) 820 (+0%) 821 utf-8 '\u0100'+'\x80'* 517 (+6%) 548 (+0%) 548 utf-8 '\u0100'*+'\u8000' 525 (+4%) 548 (+0%) 548 utf-8 '\u0100'*+'\U0001' 517 (+6%) 549 (+0%) 549 utf-8 '\u8000'*1 490 (-8%) 433 (+4%) 451 utf-8 '\u8000'+'A'* 818 (+0%) 819 (+0%) 821 utf-8 '\u8000'+'\x80'* 529 (+4%) 548 (+0%) 548 utf-8 '\u8000'+'\u0100'*529 (+4%) 548 (+0%) 548 utf-8 '\u8000'*+'\U0001' 470 (-4%) 451 (+0%) 451 utf-8 '\U0001'*1 554 (-18%)427 (+6%) 453 utf-8 '\U0001'+'A'* 938 (+0%) 927 (+2%) 941 utf-8 '\U0001'+'\x80'* 572 (+4%) 595 (+0%) 595 utf-8 '\U0001'+'\u0100'*571 (+4%) 595 (+0%) 595 utf-8 '\U0001'+'\u8000'*503 (-4%) 481 (+0%) 482 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14654 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14703] Update PEP metaprocesses to describe PEP czar role
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14703 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14693] hashlib fallback modules should be built even if openssl *is* available at build time
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14693 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14093] Mercurial version information not appearing in Windows builds
Martin v. Löwis mar...@v.loewis.de added the comment: Please go ahead and apply it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14093 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
Arve Knudsen arve.knud...@gmail.com added the comment: Which HTTP methods should we auto-define content-length for? POST and PUT? I noticed that my first attempt at a patch would define content-length also for GET requests, which broke a unit test (test_ipv6host_header). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14662] shutil.move doesn't handle ENOTSUP raised by chflags on OS X
Antoine Pitrou pit...@free.fr added the comment: Looks ok to me, but I don't have a system with os.chflags to test on. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14662 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14678] Update zipimport to support importlib.invalidate_caches()
Brett Cannon br...@python.org added the comment: I should mention I have a version from importers that is probably out-of-date: http://code.google.com/p/importers/source/browse/importers/zip.py -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14678 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11618] Locks broken wrt timeouts on Windows
Antoine Pitrou pit...@free.fr added the comment: I agree that Martin that it's not a good idea to add dead code. Furthermore, you patch has: +#ifndef _PY_EMULATED_WIN_CV +#define _PY_EMULATED_WIN_CV 0 /* use emulated condition variables */ +#endif + +#if !defined NTDDI_VISTA || NTDDI_VERSION NTDDI_VISTA +#undef _PY_EMULATED_WIN_CV +#define _PY_EMULATED_WIN_CV 1 +#endif so am I right to understand that when compiled under Vista or later, it will produce an XP-incompatible binary? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14711] Remove os.stat_float_times
Antoine Pitrou pit...@free.fr added the comment: +1 for deprecating. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14711 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2377] Replace __import__ w/ importlib.__import__
Changes by Brett Cannon br...@python.org: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2377 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11943] Add TLS-SRP (RFC 5054) support to ssl, _ssl, http, and urllib
Antoine Pitrou pit...@free.fr added the comment: Quinn, are you planning to work on an updated patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11943 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14722] Overflow in parsing 'float' parameters in PyArg_ParseTuple*
Serhiy Storchaka storch...@gmail.com added the comment: I also thought about ±∞. But PyLong_AsDouble() raises OverflowError for out-of-range value. And it checks strictly out of ±DBL_MAX. Because float(10**1000) returns no float('inf'), but raises an exception, I think that returning ±∞ will be wrong. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14722 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14692] json.loads parse_constant callback not working anymore
Changes by Terry J. Reedy tjre...@udel.edu: -- title: json.joads parse_constant callback not working anymore - json.loads parse_constant callback not working anymore ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14692 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14722] Overflow in parsing 'float' parameters in PyArg_ParseTuple*
Mark Dickinson dicki...@gmail.com added the comment: And it checks strictly out of ±DBL_MAX. Nope. Values just larger than DBL_MAX won't raise OverflowError here. Because float(10**1000) returns no float('inf'), but raises an exception, I think that returning ±∞ will be wrong. Possibly. But there's also the fact that 3.2 already returns inf here; we'd need a pretty good reason to break that. Like I said, I'm not sure which the right way to go here is. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14722 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
Arve Knudsen arve.knud...@gmail.com added the comment: Actually, when inspecting the HTTP requests sent by Chrome for the different methods (a great little Chrome app called Postman let me fire requests manually), I found that content-length would be set for most methods. I could confirm that 'content-length: 0' would be set for the following methods: POST, PUT, PATCH, DELETE and HEAD. I guess it should be good enough to model that behaviour in httplib? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14701] parser module doesn't support 'raise ... from'
Terry J. Reedy tjre...@udel.edu added the comment: Just curious, should The parser module provides an interface to Python’s internal parser and byte-code compiler. say CPython's? -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14701 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14723] Misleading error message for str.format()
New submission from Mark Theisen mark.thei...@digitecinc.com: When I run this code: '{0:i}'.format(None) I get this error: ValueError: Unknown format code 'i' for object of type 'str' This seems misleading because None is of Type 'NoneType'. I was expecting the error to say something to the effect of: Unknown format code 'i' for object of type 'NoneType' -- components: Interpreter Core messages: 159955 nosy: theisenm priority: normal severity: normal status: open title: Misleading error message for str.format() type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14723 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14701] parser module doesn't support 'raise ... from'
Mark Dickinson dicki...@gmail.com added the comment: Hmm. Possibly, yes. At least, it should be clear somehow from the docs that the parser, symbol, token and ast modules are CPython specific. (And possibly tokenize, too.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14701 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14723] Misleading error message for str.format()
Eric V. Smith e...@trueblade.com added the comment: This is a duplicate of issue 13790. See the comments there for why it works this way. -- nosy: +eric.smith resolution: - duplicate status: open - closed superseder: - In str.format an incorrect error message for list, tuple, dict, set ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14723 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13790] In str.format an incorrect error message for list, tuple, dict, set
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13790 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
Jesús Cea Avión j...@jcea.es added the comment: HEAD?. It doesn't make sense in HEAD if it doesn't make sense in GET. Looking around, I found this, to mud the water a little bit more: http://fixunix.com/tcp-ip/66198-http-rfc-related-question-content-length-0-get-request.html. Not being explicit about this is a bug in the specification, I think. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14657] Avoid two importlib copies
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 257cbd2fac38 by Brett Cannon in branch 'default': Issue #13959: Re-implement imp.get_suffixes() in Lib/imp.py. http://hg.python.org/cpython/rev/257cbd2fac38 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14657 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13959] Re-implement parts of imp in pure Python
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 257cbd2fac38 by Brett Cannon in branch 'default': Issue #13959: Re-implement imp.get_suffixes() in Lib/imp.py. http://hg.python.org/cpython/rev/257cbd2fac38 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13959 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13959] Re-implement parts of imp in pure Python
Brett Cannon br...@python.org added the comment: OK, I'm waiting on issue #14657 (avoiding the _frozen_importlib/importlib dichotomy) is resolved before I document the new imp.extension_suffixes() as it would be good to know where I should pull in the source and bytecode suffixes. I think this only leaves get_magic() and get_tag() as the only things to move + trying to figure out how to handle PyImport_ExecCodeModuleObject() and its grip on various bits of C code. -- dependencies: +Avoid two importlib copies ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13959 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14722] Overflow in parsing 'float' parameters in PyArg_ParseTuple*
Serhiy Storchaka storch...@gmail.com added the comment: Here is a patch with tests. Nope. Values just larger than DBL_MAX won't raise OverflowError here. Isn't that a little bit. But values that rounded to DBL_MAX can raise OverflowError. In any case it's too difficult to achieve strict behavior in this corner case. Possibly. But there's also the fact that 3.2 already returns inf here; we'd need a pretty good reason to break that. In the end, we may add the environment variable PYTHONDONTRAISEEXCEPTIONIFFLOATOVERFLOWS to control this behaviour. Like I said, I'm not sure which the right way to go here is. Take a look at the tests and may be you'll see the system. -- Added file: http://bugs.python.org/file25455/getargs_float_overflow_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14722 ___diff -r 01824bf55376 Lib/test/test_getargs2.py --- a/Lib/test/test_getargs2.py Fri May 04 11:06:09 2012 -0400 +++ b/Lib/test/test_getargs2.py Fri May 04 22:07:37 2012 +0300 @@ -1,4 +1,5 @@ import unittest +import math from test import support from _testcapi import getargs_keywords, getargs_keyword_only @@ -22,6 +23,9 @@ K * unsigned long long none L long long LLONG_MIN..LLONG_MAX + f float -FLT_MAX..FLT_MAX + d double -DBL_MAX..DBL_MAX + Notes: * New format codes. @@ -39,17 +43,25 @@ from _testcapi import UCHAR_MAX, USHRT_MAX, UINT_MAX, ULONG_MAX, INT_MAX, \ INT_MIN, LONG_MIN, LONG_MAX, PY_SSIZE_T_MIN, PY_SSIZE_T_MAX, \ - SHRT_MIN, SHRT_MAX + SHRT_MIN, SHRT_MAX, \ + FLT_MAX, FLT_EPSILON, DBL_MAX, DBL_EPSILON # fake, they are not defined in Python's header files LLONG_MAX = 2**63-1 LLONG_MIN = -2**63 ULLONG_MAX = 2**64-1 +INF = float('inf') +NAN = float('nan') + class Int: def __int__(self): return 99 +class Float: +def __float__(self): +return 34.125 + class Unsigned_TestCase(unittest.TestCase): def test_b(self): from _testcapi import getargs_b @@ -215,6 +227,50 @@ self.assertEqual(VERY_LARGE ULLONG_MAX, getargs_K(VERY_LARGE)) +class Float_TestCase(unittest.TestCase): +def test_f(self): +from _testcapi import getargs_f +# f returns 'float', and does range checking (-FLT_MAX ... FLT_MAX) +self.assertRaises(TypeError, getargs_f, Hello) +self.assertEqual(34.125, getargs_f(Float())) + +self.assertRaises(OverflowError, getargs_f, -int(FLT_MAX) - int(FLT_MAX*FLT_EPSILON)) +self.assertEqual(FLT_MAX, getargs_f(FLT_MAX)) +self.assertEqual(-FLT_MAX, getargs_f(-FLT_MAX)) +self.assertRaises(OverflowError, getargs_f, int(FLT_MAX) + int(FLT_MAX*FLT_EPSILON)) +if -FLT_MAX != -FLT_MAX - FLT_MAX*FLT_EPSILON: +self.assertRaises(OverflowError, getargs_f, -FLT_MAX - FLT_MAX*FLT_EPSILON) +if FLT_MAX != FLT_MAX + FLT_MAX*FLT_EPSILON: +self.assertRaises(OverflowError, getargs_f, FLT_MAX + FLT_MAX*FLT_EPSILON) + +self.assertEqual(0, getargs_f(0)) +self.assertEqual(34.125, getargs_f(34.125)) +self.assertRaises(OverflowError, getargs_f, 10**1000) + +self.assertEqual(INF, getargs_f(INF)) +self.assertEqual(-INF, getargs_f(-INF)) +self.assertTrue(math.isnan(getargs_f(NAN))) + +def test_d(self): +from _testcapi import getargs_d +# d returns 'double', and does range checking (-DBL_MAX ... DBL_MAX) +self.assertRaises(TypeError, getargs_d, Hello) +self.assertEqual(34.125, getargs_d(Float())) + +self.assertRaises(OverflowError, getargs_d, -int(DBL_MAX) - int(DBL_MAX*DBL_EPSILON)) +self.assertEqual(DBL_MAX, getargs_d(DBL_MAX)) +self.assertEqual(-DBL_MAX, getargs_d(-DBL_MAX)) +self.assertRaises(OverflowError, getargs_d, int(DBL_MAX) + int(DBL_MAX*DBL_EPSILON)) + +self.assertEqual(0, getargs_d(0)) +self.assertEqual(34.125, getargs_d(34.125)) +self.assertRaises(OverflowError, getargs_d, 10**1000) + +self.assertEqual(INF, getargs_d(INF)) +self.assertEqual(-INF, getargs_d(-INF)) +self.assertTrue(math.isnan(getargs_d(NAN))) + + class Tuple_TestCase(unittest.TestCase): def test_tuple(self): from _testcapi import getargs_tuple @@ -510,6 +566,7 @@ tests = [ Signed_TestCase, Unsigned_TestCase, +Float_TestCase, Tuple_TestCase, Keywords_TestCase, KeywordOnly_TestCase, diff -r 01824bf55376 Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c Fri May 04 11:06:09 2012 -0400 +++ b/Modules/_testcapimodule.c Fri May 04 22:07:37 2012 +0300 @@ -992,6 +992,24 @@ } static PyObject * +getargs_f(PyObject *self, PyObject *args) +{ +float value; +if (!PyArg_ParseTuple(args, f, value)) +return NULL; +return PyFloat_FromDouble(value); +} + +static PyObject * +getargs_d(PyObject
[issue14722] Overflow in parsing 'float' parameters in PyArg_ParseTuple*
Changes by Serhiy Storchaka storch...@gmail.com: -- type: - enhancement versions: -Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14722 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
Arve Knudsen arve.knud...@gmail.com added the comment: Here's my initial proposal for a patch against httplib, based on the 2.7 branch of cpython repository. I've included a couple of tests, which check that when content is empty, content-length is set to 0 for certain methods (POST/PUT etc) and not specified for others. -- keywords: +patch Added file: http://bugs.python.org/file25456/httplib-2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14721] httplib doesn't specify content-length header for POST requests without data
Arve Knudsen arve.knud...@gmail.com added the comment: Yes, I agree it doesn't make much sense for HEAD AFAICT, but Chrome does it. Maybe there's a reason? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14722] Overflow in parsing 'float' parameters in PyArg_ParseTuple*
Mark Dickinson dicki...@gmail.com added the comment: But values that rounded to DBL_MAX can raise OverflowError. In any case it's too difficult to achieve strict behavior in this corner case. Well, PyLong_AsDouble *does* achieve strict behaviour in this corner case :-). Integers less than 0.5 * (sys.float_info.max + 2**1024) in absolute value give finite results; integers greater than or equal to that bound produce an OverflowError. Take a look at the tests and may be you'll see the system. I don't see how looking at the tests helps with making a decision about breaking backwards compatibility or not. :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14722 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14093] Mercurial version information not appearing in Windows builds
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 4459d82ff127 by Vinay Sajip in branch 'default': Closes #14093: Added Mercurial version information to Windows builds. http://hg.python.org/cpython/rev/4459d82ff127 -- nosy: +python-dev resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14093 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14578] importlib doesn't check Windows registry for paths
Brett Cannon br...@python.org added the comment: FYI, I just deleted PC/import_nt.c as it stopped compiling after my removal of _imp.get_suffixes(). Obviously hg has the history of the file so if someone needs to resurrect it there shouldn't be much issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14578 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13959] Re-implement parts of imp in pure Python
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 22b0689346f9 by Brett Cannon in branch 'default': Issue #13959: Move module type constants to Lib/imp.py. http://hg.python.org/cpython/rev/22b0689346f9 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13959 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14662] shutil.move doesn't handle ENOTSUP raised by chflags on OS X
Ned Deily n...@acm.org added the comment: I will test and check it in next week if still open. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14662 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14724] kill imp.load_dynamic's third argument
Brett Cannon br...@python.org added the comment: +1 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14724 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14724] kill imp.load_dynamic's third argument
New submission from Antoine Pitrou pit...@free.fr: imp.load_dynamic's third optional argument doesn't seem used in the wild, and I don't think it's correctly implemented by the current code. It would seem reasonable to kill it. -- components: Interpreter Core, Library (Lib) messages: 159971 nosy: brett.cannon, eric.smith, ncoghlan, pitrou priority: normal severity: normal status: open title: kill imp.load_dynamic's third argument versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14724 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14725] test_multiprocessing failure under Windows
New submission from Antoine Pitrou pit...@free.fr: There was this failure on one of the XP buildbots: Process Process-269: Traceback (most recent call last): File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\process.py, line 258, in _bootstrap self.run() File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\process.py, line 95, in run self._target(*self._args, **self._kwargs) File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_multiprocessing.py, line 1980, in _listener new_conn = l.accept() File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\connection.py, line 444, in accept c = self._listener.accept() File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\connection.py, line 624, in accept ov = _winapi.ConnectNamedPipe(handle, overlapped=True) BrokenPipeError: [Error 232] The pipe is being closed == ERROR: test_pickling (test.test_multiprocessing.WithProcessesTestPicklingConnections) -- Traceback (most recent call last): File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\connection.py, line 308, in _recv_bytes nread, err = ov.GetOverlappedResult(True) BrokenPipeError: [Error 109] The pipe has been ended During handling of the above exception, another exception occurred: Traceback (most recent call last): File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_multiprocessing.py, line 2030, in test_pickling new_conn = lconn.recv() File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\connection.py, line 252, in recv buf = self._recv_bytes() File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\multiprocessing\connection.py, line 317, in _recv_bytes raise EOFError EOFError (http://www.python.org/dev/buildbot/all/builders/x86%20XP-4%203.x/builds/6534/steps/test/logs/stdio) -- components: Library (Lib), Tests, Windows messages: 159973 nosy: pitrou, sbt priority: normal severity: normal status: open title: test_multiprocessing failure under Windows type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14725 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14726] Lib/email/*.py use an EMPTYSTRING global instead of ''
New submission from Gregory P. Smith g...@krypto.org: Lib/email/*.py are fond of using EMPTYSTRING = '' and within the code: EMPTYSTRING.join(...) instead of just writing: ''.join(...) They should just do the latter. It'll avoid a name lookup and look less silly to people reading the code. ;) -- messages: 159974 nosy: gregory.p.smith priority: low severity: normal status: open title: Lib/email/*.py use an EMPTYSTRING global instead of '' versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14726 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14726] Lib/email/*.py use an EMPTYSTRING global instead of ''
R. David Murray rdmur...@bitdance.com added the comment: I've always wondered why the code did that. If Barry doesn't have a good reason for it, I'll refactor it at some point. -- assignee: - r.david.murray nosy: +barry, r.david.murray type: - performance ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14726 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14695] Tools/parser/unparse.py is out of date.
R. David Murray rdmur...@bitdance.com added the comment: There is a test_tools file now. test_unparse could be called from it. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14695 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14702] os.makedirs breaks under autofs directories
R. David Murray rdmur...@bitdance.com added the comment: Hynek: it doesn't seem like that would work, since legitimate EPERM errors are much more likely. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14702 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14726] Lib/email/*.py use an EMPTYSTRING global instead of ''
Barry A. Warsaw ba...@python.org added the comment: On May 05, 2012, at 01:25 AM, R. David Murray wrote: I've always wondered why the code did that. If Barry doesn't have a good reason for it, I'll refactor it at some point. A long time ago, Tim (IIRC) expressed an opinion that using the variable makes the code more readable. After having seen so much code that uses the string literals over the years, I wholeheartedly agree with that opinion. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14726 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com