[issue23214] BufferedReader.read1(size) signature incompatible with BufferedIOBase.read1(size=-1)
New submission from Martin Panter: I am trying to make LZMAFile (which implements BufferedIOBase) use a BufferedReader in read mode. However this broke test_lzma.FileTestCase.test_read1_multistream(), which calls read1() with the default size argument. This is because BufferedReader.read1() does not accept size=-1: stdin = open(0, rb, closefd=False) stdin _io.BufferedReader name=0 stdin.read1() # Parameter is mandatory Traceback (most recent call last): File stdin, line 1, in module TypeError: read1() takes exactly 1 argument (0 given) stdin.read1(-1) # Does not accept the BufferedIOBase default Traceback (most recent call last): File stdin, line 1, in module ValueError: read length must be positive stdin.read1(0) # Technically not positive b'' Also, the BufferedIOBase documentation does not say what the size=-1 value means, only that it reads and returns up to -1 bytes. -- components: IO messages: 233794 nosy: vadmium priority: normal severity: normal status: open title: BufferedReader.read1(size) signature incompatible with BufferedIOBase.read1(size=-1) versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23214 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23201] Decimal(0)**0 is an error, 0**0 is 1, but Decimal(0) == 0
Tim Peters added the comment: This is easy: Cowlishaw is wrong on this one, but nothing can be done about it ;-) Confusion arises because most people think of 0**0 as a value (where it certainly must be 1) while others seem to view it as some kind of shorthand for expressing a limit (as the base and/or exponent _approach_ 0, in which case there is no correct answer - it's an indeterminate form). It's in the spirit of 754 to take inputs at face value, viewing them as infinitely precise. So viewing 0**0 as anything other than 1 in this context is perverse. Centuries of history distilled to a few paragraphs here: http://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_power_of_zero -- nosy: +tim.peters ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23201 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23086] Add start and stop parameters to the Sequence.index() ABC mixin method
Devin Jeanpierre added the comment: I inferred from Serhiy's comment that if you override __iter__ to be efficient and not use __getitem__, this overridden behavior used to pass on to index(), but wouldn't after this patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23086 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23215] MemoryError with custom error handlers and multibyte codecs
Changes by Aleksi Torhamo alexerion+pythonb...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file37660/python_codec_crash_fix.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23215 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23144] html.parser.HTMLParser: setting 'convert_charrefs = True' leads to dropped text
Changes by Ezio Melotti ezio.melo...@gmail.com: -- assignee: docs@python - ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23144 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23215] MemoryError with custom error handlers and multibyte codecs
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +haypo, lemburg, loewis, serhiy.storchaka stage: - patch review versions: -Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23215 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Berker Peksag added the comment: Hi Tommy, the patch is already committed to Python 3.5. See https://docs.python.org/3.5/library/heapq.html#heapq.merge -- nosy: +berker.peksag stage: patch review - resolved ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23215] MemoryError with custom error handlers and multibyte codecs
New submission from Aleksi Torhamo: Using a multibyte codec and a custom error handler that ignores errors to encode a string that contains characters not representable in said encoding causes exponential growth of the output buffer, raising MemoryError. The problem is in multibytecodec_encerror() and REQUIRE_ENCODEBUFFER() in Modules/cjkcodecs/multibytecodec.c. multibytecodec_encerror() always uses REQUIRE_ENCODEBUFFER() to ensure there's enough space for the replacement string, and if more space is needed, REQUIRE_ENCODEBUFFER() calls expand_encodebuffer(), which in turn always grows the buffer by at least 50%. However, if size 1, REQUIRE_ENCODEBUFFER() doesn't check if more space is actually needed. (It's used with negative values in other places) I have no idea why the condition was originally size 1 instead of size 0, but changing it seems to fix this. The replacement string case is also the only use of the macro that may use 0 as the argument. In the patch, I've instead wrapped the REQUIRE_ENCODEBUFFER() (and memcpy) in a if(size 0), since that's what the corresponding part in multibytecodec_decerror() did in the past: https://hg.python.org/cpython/file/1c3f8d044589/Modules/cjkcodecs/multibytecodec.c#l438 Not sure which one makes more sense. As for the tests, I'm not sure if 1) all of the affected encodings should be tested or only one (or even all encodings, affected or not?) and 2) whether it should be a new test or if I should just add it to test_longstrings in Lib/test/test_codeccallbacks.py. (Structurally it's a perfect fit, but it really isn't a long string test as it can happen with 50 characters) At the moment, the patch is testing affected encodings in a separate test. Is the test philosophy as thorough as possible or as fast as possible? -- components: Interpreter Core files: python_codec_crasher.py messages: 233800 nosy: alexer priority: normal severity: normal status: open title: MemoryError with custom error handlers and multibyte codecs type: resource usage versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file37659/python_codec_crasher.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23215 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Tommy Carstensen added the comment: I noticed 3.5 alpha1 is not released until February 1st. Is there any way I can get my hands on this new functionality? -- nosy: +Tommy.Carstensen ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Tommy Carstensen added the comment: Yes, but 3.5 has not been pre-released yet. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23201] Decimal(0)**0 is an error, 0**0 is 1, but Decimal(0) == 0
Steven D'Aprano added the comment: Mark Dickson wrote: I've talked to Mike Cowlishaw (the author of the specification) about this particular issue, and the spec is not likely to change on this point. I'm curious about the rationale for the decision. As I'm sure you're aware, in general 0**0 is treated as 1 by both a majority (I think) of mathematicians and programming languages. As Knuth puts it, the binomial theorem is too important to do otherwise. IEEE 754 treats it as 1, although the 2008 revision adds a second power function powr() which returns NAN if both arguments are 0. So I wonder why the decimal spec choose to do otherwise? (Not saying they're wrong to do so.) -- nosy: +steven.daprano ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23201 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15955] gzip, bz2, lzma: add option to limit output size
Martin Panter added the comment: Here is a patch for the higher-level LZMAFile implementation to use Nikolaus’s “max_length” parameter. It depends on Nikolaus’s patch also being applied. I split out a _RawReader class that does the actual decompress() calls, and then wrapped that in a BufferedReader. This avoids needing any special code to implement buffering, readline(), etc. The only significant changes in the API that I can see are: * LZMAFile now inherits the useless specification of BufferedReader.peek(), losing the guarantee of returning at least a single byte. I questioned the BufferedReader specification at https://bugs.python.org/issue5811#msg233750. * read() now accepts size=None, because BufferedReader does. I had to change a test case for this. -- Added file: http://bugs.python.org/file37658/LZMAFile.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15955 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20699] Behavior of ZipFile with file-like object and BufferedWriter.
Martin Panter added the comment: I think the simplest thing to do here would be to update the documentation to match the usage. This patch does so, saying that all write() methods, as well as the BytesIO() constructor, have to accept bytes-like objects. It also expands some tests to verify this, and fixes a resulting bug in _pyio. -- assignee: - docs@python components: +Documentation keywords: +patch nosy: +docs@python Added file: http://bugs.python.org/file37662/bytes-like-param.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20699 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5811] io.BufferedReader.peek(): Documentation differs from Implementation
Martin Panter added the comment: Here is a simple documentation patch to guarantee that at least one byte is normally returned. This would make the method much more useful, and compatible with the BZ2File and LZMAFile interfaces, allowing them to use BufferedReader, as I propose to do in Issue 15955. Even if nobody is interested in Torsten’s patch to limit the return length, I suggest my patch be considered :) -- assignee: - docs@python components: +Documentation nosy: +docs@python Added file: http://bugs.python.org/file37661/peek-one-byte.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5811 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23213] subprocess communicate() hangs when stderr isn't closed
Martin Panter added the comment: I suspect this is not a bug but a misunderstanding of how communiate(), pipes, daemon processes, etc, work. If communicate() didn’t wait for stderr to be closed, then how would it know it had read all the data that was written into the pipe? I don’t have that version of “systemd”, but I guess your daemon leaves its output pipes open and continues to run in the background, so communicate() is waiting in case the daemon writes anything to the pipes. This would demonstrate the same situation using a Python subprocess: import subprocess import sys script = import os, time if not os.fork(): # Child process time.sleep(30) print(Finally!) args = (sys.executable, -c, script) proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc.communicate() # Hangs for 30 s and then returns (b'Finally!\n', b'') If you want communicate() to return as soon as a daemon forks into the background, don’t read from the daemon’s output pipes. If you want to read data that the foreground process writes and ignore any data that the background process might write to the same pipes, that’s asking for race conditions. -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23213 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23206] json.dumps(ensure_ascii=False) is ~10x slower than json.dumps()
Antoine Pitrou added the comment: Thank you for the patch! I posted a review. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23206 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23213] subprocess communicate() hangs when stderr isn't closed
New submission from Thomas D.: Hi, to demonstrate the problem you need =systemd-217: # python3.4 Python 3.4.2 (default, Oct 12 2014, 20:09:43) [GCC 4.8.3] on linux Type help, copyright, credits or license for more information. import subprocess sp = subprocess.Popen([/sbin/udevd, --daemon], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = sp.communicate() [hangs] ps will show root 9619 0.0 0.1 23340 5404 pts/5Ss Jan09 0:00 \_ -bash root 13291 0.0 0.2 45352 9784 pts/5S+ 00:34 0:00 \_ python3.4 root 13311 0.0 0.0 0 0 pts/5Z+ 00:34 0:00 \_ [udevd] defunct Calling /sbin/udevd --daemon from the shell works fine. errorlog = open(/tmp/stderr.log, wb) sp = subprocess.Popen([/sbin/udevd, --daemon], stdout=subprocess.PIPE, stderr=errorlog) works, too. The problem first appeared in systemd-217. I bisected systemd's source code and the commit since when Python's subprocess module is unable to start udevd is https://github.com/systemd/systemd/commit/5c67cf2774a8b964f4d7cd92a4c447da81ac6087 This is not a systemd/udev only problem. The problem was first seen with the php-fpm daemon from PHP (but only when using error_log = syslog). Please see the original bug report at https://github.com/saltstack/salt/issues/14957 for more details. Because Salt is still at Python 2.7, the problem can be reproduced with Python 2.7, too. Is it a bug in subprocess? In systemd/PHP? Are we (salt) using subprocess the wrong way? Thanks! PS: On your system, /sbin/udevd will be probably /lib/systemd/systemd-udevd Not sure if this is related to http://bugs.python.org/issue12786 in some ways. -- components: Library (Lib) messages: 233788 nosy: whissi priority: normal severity: normal status: open title: subprocess communicate() hangs when stderr isn't closed type: behavior versions: Python 2.7, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23213 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19776] Provide expanduser() on Path objects
Antoine Pitrou added the comment: Victor, your patch sounds ok to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19776 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23188] Exception chaining should trigger for non-normalised exceptions
Antoine Pitrou added the comment: The interesting discovery I made while reviewing the patch for issue 22906 is that there apparently *is* implicit chaining support in PyErr_SetObject Indeed, there is, and it should work properly (AFAIR there was quite a bit of debugging to make this work). Also, note that normalizing is already handled. I'm not sure what you're witnessing that doesn't work as expected. I suspect that you may be confusing an exception has been caught (and is ready to be chained from) with an exception has been raised (i.e. PyErr_Occurred() is true). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23188 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23208] asyncio: add BaseEventLoop._current_handle
New submission from STINNER Victor: One pain point of asynchronous programming is to understand bugs and rebuild the chain of callbacks / coroutines / tasks. I added the source traceback to Handle, Future (Task) and CoroWrapper to help debugging. Here is a new enhancement to provide more context in debug mode: add BaseEventLoop._current_handle which is the handle currently executed. The first usage is the call_exception_handler() which logs the source traceback of the current handle in debug mode. Example: --- import asyncio def bug(): loop.call_exception_handler({'message': 'bug!'}) def schedule_bug(): bug() loop = asyncio.get_event_loop() loop.call_soon(schedule_bug) loop.call_later(1, loop.stop) loop.run_forever() loop.close() --- Output in debug mode, without the patch: --- bug! --- Output in debug mode, with the patch: --- bug! handle_traceback: Handle created at (most recent call last): File x.py, line 10, in module loop.call_soon(schedule_bug) --- Later, I plan to use the source traceback of the current handle in more places. For example, use it to log messages. I would like to know who logged the SSL handshake failed. At the beginning, I wanted to add a source traceback to all transports, but it looks simpler to get the source traceback of the current handler. Moreover, this traceback is more useful than the source traceback of the transport. Previous try to add the source traceback to transports: https://code.google.com/p/tulip/issues/detail?id=212 -- components: asyncio files: current_handle.patch keywords: patch messages: 233759 nosy: gvanrossum, haypo, yselivanov priority: normal severity: normal status: open title: asyncio: add BaseEventLoop._current_handle versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file37655/current_handle.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23208 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23206] json.dumps(ensure_ascii=False) is ~10x slower than json.dumps()
INADA Naoki added the comment: Patch update. Now C version does escaping same way to Python version. -- Added file: http://bugs.python.org/file37656/json-fast-unicode-encode.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23206 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23086] Add start and stop parameters to the Sequence.index() ABC mixin method
Raymond Hettinger added the comment: The iteration usually has linear complexity The iteration abstract method depends on indexing as well: def __iter__(self): i = 0 try: while True: v = self[i] yield v i += 1 except IndexError: return -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23086 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22411] Embedding Python on Windows
Joakim Karlsson added the comment: You shouldn't mix headers with and without the _DEBUG symbol defined. At least on some versions of MSVC this can lead to errors as some standard headers start referencing functions that are not available in both debug and release versions of the MSV C runtime. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22411 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23208] asyncio: add BaseEventLoop._current_handle
STINNER Victor added the comment: Yury Selivanov proposed something different in the past: add a context (or a context identifier) to tasks to be able to (indirectly) attach local variables to tasks. Add notion of context_id to event loop https://code.google.com/p/tulip/issues/detail?id=165 I don't know if BaseEventLoop._current_handle is too specific or might be implemented with a task context. The task context looks to be specific to tasks, whereas handles are very generic in asyncio: almost all functions in asyncio are called in the context of a handle. Previous discussion related to task context: local context in event loop https://groups.google.com/forum/#!topic/python-tulip/zix5HQxtElg ThreadLocal analogue https://groups.google.com/forum/#!topic/python-tulip/j0cSjUGx8qk See also the tasklocals project: https://github.com/vkryachko/tasklocals -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23208 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22986] Improved handling of __class__ assignment
Changes by Berker Peksag berker.pek...@gmail.com: -- nosy: +benjamin.peterson stage: - patch review type: - enhancement versions: +Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22986 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23086] Add start and stop parameters to the Sequence.index() ABC mixin method
Raymond Hettinger added the comment: I'm afraid you're getting lost in details that don't matter. We're trying to make the index() method more useful so that searches and be restarted where they left off. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23086 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23204] list.index and rest of list methods disagree if a value is in the list if it's mutated during the call
Serhiy Storchaka added the comment: This is because list.index() has start and stop parameters, and L.index(x) is equivalent to L.index(x, 0, len(L)). In list.count() and list.remove() the limit is dynamic during iteration, but in list.index() it is specified by arguments before iterating. It is possible to make the limit static in list.count() and list.remove() or to make it floating if stop is absent or negative in list.index(), but this will complicate and slow down the code without good reason. I suggest to close this issue as wont fix. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23204 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23204] list.index and rest of list methods disagree if a value is in the list if it's mutated during the call
Raymond Hettinger added the comment: This is a non-guaranteed behavior. It is allowed to be different from other list methods. The behavior is also very old, stable, and has not been a problem in practice. No good would come from changing it. -- nosy: +rhettinger resolution: - not a bug status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23204 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23196] Greek letters not sorted properly
Pierre Nugues added the comment: Hello David, This is not the same issue as 23195. I tested the Greek letters on your interactive console available at Python.org and this is not related to OS X. The Greek sorting works for all the characters I tested except the ‘ῖ’ character, which is in the extended Greek block. This probably explains why it is not properly collated. ICU sorts the letters properly, including ‘ῖ’. I think you should restore my original issue post. Kindest regards, Pierre -- Pierre Nugues, Lunds Tekniska Högskola, Institutionen för datavetenskap, Box 118, S-221 00 Lund, Suède. Tél. (0046) 46 222 96 40, http://cs.lth.se/pierre_nugues Visiteurs: Lunds Tekniska Högskola, E-huset, rum 4134A, Ole Römers väg 3, S-223 63 Lund. Mon livre/My book: http://ilppp.cs.lth.se (2nd edition, 2014) Le 8 janv. 2015 à 22:48, R. David Murray rep...@bugs.python.org a écrit : R. David Murray added the comment: Oops, I meant issue 23195. -- superseder: Greek letters not sorted properly - Sorting with locale (strxfrm) does not work properly with Python3 on Macos ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23196 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23196 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23189] Set docstrings to empty string when optimizing with -OO.
Raymond Hettinger added the comment: It seems to me that the problem here lies with the packages that use __doc__+=sometext rather than with -OO which is doing exactly what it is supposed to. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23196] Greek letters not sorted properly
STINNER Victor added the comment: Which order do you expect? What is your OS? Result on Linux (Fedora 21) with the french UTF-8 locale. locale.setlocale(locale.LC_ALL, '') 'fr_FR.utf8' locale.getlocale(locale.LC_COLLATE) ('fr_FR', 'UTF-8') sorted(x) ['Ά', 'Γ', 'Η', 'Κ', 'Ν', 'Ο', 'έ', 'ί', 'α', 'β', 'γ', 'δ', 'ε', 'ζ', 'ι', 'κ', 'λ', 'μ', 'ν', 'ο', 'ς', 'τ', 'φ', 'χ', 'ό', 'ϐ', 'Ἀ', 'ῖ'] sorted(x, key=locale.strxfrm) ['Ἀ', 'ῖ', 'α', 'Ά', 'β', 'ϐ', 'Γ', 'γ', 'δ', 'ε', 'έ', 'ζ', 'Η', 'ι', 'ί', 'Κ', 'κ', 'λ', 'μ', 'Ν', 'ν', 'Ο', 'ο', 'ό', 'ς', 'τ', 'φ', 'χ'] I don't speak greek, I don't know which order is expected. Anyway, as explained in the issue #23195, Python doesn't implement locale.strxfrm(): it just exposes the system functions. On Linux, locales are implemented in the GNU C library (libc) for example. So I don't see what should be done to fix this issue. We are not going to implement locales in Python, use an external library like ICU if you want better locales and have a better control on locales. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23196 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23188] Exception chaining should trigger for non-normalised exceptions
Nick Coghlan added the comment: The interesting discovery I made while reviewing the patch for issue 22906 is that there apparently *is* implicit chaining support in PyErr_SetObject: https://hg.python.org/cpython/file/default/Python/errors.c#l70 Chris indicates that it doesn't seem to be triggering for his patch, though (even after normalising and then restoring the exception state), and I haven't fully dug into why yet. Preliminary explorations show that the last two functional modifications were a fix for a crash bug in issue 3611, and Antoine's original implementation of exception chaining in issue 3108. I've added Antoine to the nosy list, as my main takeaway at the moment is that I *don't* currently understand what's going on with the exception chaining, and I'd like to before we merge the PEP 479 patch. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23188 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23185] add inf and nan to math module
STINNER Victor added the comment: 2015-01-09 8:16 GMT+01:00 Serhiy Storchaka rep...@bugs.python.org: May be make math.inf and math.nan special objects so that for all x (except inf and nan): What do you mean? Implement a subtype of float and override some methods? x math.inf x -math.inf It's already the case for int, float and decimal.Decimal. not (x math.nan) not (x math.nan) Comparison to nan always return False. I would be better to raise an error when nan is compared to other numbers (I mean operations like ab, not a==b), but Python was not designed like that (nor the IEEE 754?). sorted((nan, 1, nan, 2)) [nan, 1, nan, 2] Sorting with NaN is a common issue :-/ See for example: https://stackoverflow.com/questions/4240050/python-sort-function-breaks-in-the-presence-of-nan Anyway, changing NaN behaviour is out of the scope of this issue! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23185 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23119] Remove unicode specialization from set objects
Marc-Andre Lemburg added the comment: On 09.01.2015 09:33, Raymond Hettinger wrote: I'm withdrawing this one. After more work trying many timings on multiple compilers and various sizes and kinds of datasets, it appears that the unicode specialization is still worth it. The cost of the lookup indirection appears to be completely insignificant (i.e. doesn't harm the non-unicode case) while the benefits of the unicode specialized lookup does have measurable benefits in the use case of deduping an iterable of strings. Thanks, Raymond, for the additional testing :-) I did a grep over the Python C source code and it seems that sets are only used by Python/symtable.c for anything mildly performance relevant (which IIRC is used by the byte code compiler) - and those sets have Unicode strings as members. The stdlib uses sets with both Unicode strings and integers as members. From looking at the grep hits, it seems that Unicode strings are more commonly used than integers in the stdlib as set members, e.g. for method names, module names and character sets. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23119 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23201] Decimal(0)**0 is an error, 0**0 is 1, but Decimal(0) == 0
Devin Jeanpierre added the comment: Does the spec have a handy list of differences to floats anywhere, or do you have to internalize the whole thing? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23201 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23196] Greek letters not sorted properly
Pierre Nugues added the comment: Hello Victor, Thank you for your prompt answer. Which order do you expect? What is your OS? Result on Linux (Fedora 21) with the french UTF-8 locale. You can try this ICU demo http://demo.icu-project.org/icu-bin/locexp?_=eld_=frx=col and paste the list: Ά Γ Η Κ Ν Ο έ ί α β γ δ ε ζ ι κ λ μ ν ο ς τ φ χ ό ϐ Ἀ ῖ You will get the same ordering as with Fedora, except the ῖ. It is a variant of i (corresponding to the letter i in Latin character). It should be sorted as an i and not just after Ἀ (the uppercase form of alpha) and before α (alpha). locale.setlocale(locale.LC_ALL, '') 'fr_FR.utf8' locale.getlocale(locale.LC_COLLATE) ('fr_FR', 'UTF-8') sorted(x) ['Ά', 'Γ', 'Η', 'Κ', 'Ν', 'Ο', 'έ', 'ί', 'α', 'β', 'γ', 'δ', 'ε', 'ζ', 'ι', 'κ', 'λ', 'μ', 'ν', 'ο', 'ς', 'τ', 'φ', 'χ', 'ό', 'ϐ', 'Ἀ', 'ῖ'] sorted(x, key=locale.strxfrm) ['Ἀ', 'ῖ', 'α', 'Ά', 'β', 'ϐ', 'Γ', 'γ', 'δ', 'ε', 'έ', 'ζ', 'Η', 'ι', 'ί', 'Κ', 'κ', 'λ', 'μ', 'Ν', 'ν', 'Ο', 'ο', 'ό', 'ς', 'τ', 'φ', 'χ'] I don't speak greek, I don't know which order is expected. Anyway, as explained in the issue #23195, Python doesn't implement locale.strxfrm(): it just exposes the system functions. On Linux, locales are implemented in the GNU C library (libc) for example. So I don't see what should be done to fix this issue. We are not going to implement locales in Python, use an external library like ICU if you want better locales and have a better control on locales. May be this would be a good idea… Kindest regards, Pierre -- Pierre Nugues, Lunds Tekniska Högskola, Institutionen för datavetenskap, Box 118, S-221 00 Lund, Suède. Tél. (0046) 46 222 96 40, http://cs.lth.se/pierre_nugues Visiteurs: Lunds Tekniska Högskola, E-huset, rum 4134A, Ole Römers väg 3, S-223 63 Lund. Mon livre/My book: http://ilppp.cs.lth.se (2nd edition, 2014) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23196 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23086] Add start and stop parameters to the Sequence.index() ABC mixin method
Serhiy Storchaka added the comment: I afraid that the patch can change computational complexity. The iteration usually has linear complexity, but indexing can has non-constant complexity. E.g. for linked list it will cause quadratic complexity of index(). May be we should have special case for start=0 and stop=None. And document this. -- nosy: +serhiy.storchaka stage: - patch review type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23086 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22560] New SSL implementation based on ssl.MemoryBIO
Changes by STINNER Victor victor.stin...@gmail.com: -- title: Add loop-agnostic SSL implementation to asyncio - New SSL implementation based on ssl.MemoryBIO ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22560 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23201] Decimal(0)**0 is an error, 0**0 is 1, but Decimal(0) == 0
Raymond Hettinger added the comment: this deserves to be spelled out in big red letters in the documentation for the decimal module, along with any other inconsistencies. I think you lost all sense of proportion here. The decimal module is obliged to follow the decimal spec (that is its reason for existence). The decimal module docs are already create a heavy mental load and their usability would not be improved shifting focus to corner case inconsistencies between types that haven't proven to be an issue in practice. If you were to go write a blog post about 0**0 versus Decimal(0)**0, I think you would find that no one cares. -- assignee: - rhettinger priority: normal - low ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23201 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23201] Decimal(0)**0 is an error, 0**0 is 1, but Decimal(0) == 0
STINNER Victor added the comment: the spec is not likely to change on this point. In this case, we should just document the behaviour with a reference to the General Decimal Arithmetic Specification. -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23201 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23201] Decimal(0)**0 is an error, 0**0 is 1, but Decimal(0) == 0
Raymond Hettinger added the comment: The docs already reference the spec. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23201 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23198] asyncio: refactor StreamReader
STINNER Victor added the comment: See also this feature request: StreamReader needs a timeout https://code.google.com/p/tulip/issues/detail?id=96 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23198 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23209] asyncio: break some cycles
New submission from Martin Richard: Hi, I would like to submit 3 trivial modifications which break a cycle each. It is not much, but those three cycles caused a lot of objects to be garbage collected. They can now be freed using the reference counting mechanism, and therefore, reduce the latency that may be involved by the work of the garbage collector in a long living process. In asyncio/base_subprocess.py: WriteSubprocessPipeProto.proc is a reference to a BaseSubprocessTransport object, which holds a reference to the WriteSubprocessPipeProto in self._protocol. I break the cycle in the protocol at the end of connection_lost(). In asyncio/futures.py: wrap_future() defines a lambda which uses a variable defined in the function, therefore creating a closure, referencing the wrap_future() function and creating a cycle. In the (really trivial) patch, the lambda uses the argument future instead of the fut variable defined in a closure. The closure is not needed anymore. This single cycle is very common, because caused when one uses getaddrinfo(). In asyncio/selectors.py: _BaseSelectorImpl._map keeps a reference to the _SelectorMapping object, which also references the selector with _SelectorMapping._selector. The reference to the map in the selector is cleared once the selector is closed. -- files: break-some-cycles.diff keywords: patch messages: 233770 nosy: martius priority: normal severity: normal status: open title: asyncio: break some cycles Added file: http://bugs.python.org/file37657/break-some-cycles.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23209 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23209] asyncio: break some cycles
Changes by Martin Richard mart...@martiusweb.net: -- components: +asyncio nosy: +gvanrossum, haypo, yselivanov type: - performance versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23209 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23210] clarify virtual sequence and range docs
New submission from Ethan Furman: The help() function explains range as being a virtual sequence, but that phrase cannot be found anywhere in the docs. Suggestion is to insert a phrase below: The advantage of the range type over a regular list or tuple is that a range object is a virtual sequence and so will always take the same (small) amount of memory [...] Bonus points for adding a glossary entry. :) -- assignee: docs@python components: Documentation messages: 233771 nosy: docs@python, ethan.furman priority: low severity: normal stage: needs patch status: open title: clarify virtual sequence and range docs versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23210 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23209] asyncio: break some cycles
Guido van Rossum added the comment: All three changes look good to me. The selectors.py fix should be applied to CPython first; the others to Tulip first. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23209 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22411] Embedding Python on Windows
Steve Dower added the comment: Right, so when using python34_d.dll you need the _d.pyd versions (and if you're building your own .pyd you need to add the _d suffix too). There's nothing wrong with this difference, since the debug and release builds are subtly incompatible with each other, so the alternative is that you'd get random crashes when mixing them. Better off getting blatant errors that files can't be found. Any option to install a debug build in 3.5 would obviously install a complete debug build - not just the one DLL. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22411 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23210] clarify virtual sequence and range docs
Ethan Furman added the comment: On 01/09/2015 09:39 AM, Guido van Rossum wrote: Please don't add this to the glossary and don't start using virtual (it is my favorite example of terminology gone wrong in C++ as well as in colloquial language). The terminology virtual sequence is only used once, and probably a holdover from the Python 2 times when the idea was to describe the difference between xrange and range. Just drop the word virtual please! I think the word has an important implication (low memory usage) and keeping it (and adding it to the range docs) would be useful to somebody who was searching for such a thing and unfamiliar with how range was constructed... on the other hand, generators are very similar (although not full Sequences) and we don't use the word virtual with them... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23210 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23210] remove the word virtual from help(range)
Ethan Furman added the comment: Others have chimed in for removal of the word virtual, with the Best In Class comment going to Guido for: To me it is a poisonous buzzword that we're better without. It has virtually no semantics left. :-) -- assignee: docs@python - components: +Interpreter Core -Documentation nosy: +pitrou title: clarify virtual sequence and range docs - remove the word virtual from help(range) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23210 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23166] urllib2 ignores opener configuration under certain circumstances
Changes by Demian Brecht demianbre...@gmail.com: -- nosy: +demian.brecht ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23166 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23210] clarify virtual sequence and range docs
Ethan Furman added the comment: Update: per Guido, we need to drop the word virtual from the help() for range. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23210 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23014] Don't have importlib.abc.Loader.create_module() be optional
Changes by Brett Cannon br...@python.org: -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23014 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23014] Don't have importlib.abc.Loader.create_module() be optional
Roundup Robot added the comment: New changeset ab72f30bcd9f by Brett Cannon in branch 'default': Issue #23014: Make importlib.abc.Loader.create_module() required when https://hg.python.org/cpython/rev/ab72f30bcd9f -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23014 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23203] Aliasing import of sub-{module, package} from the package raises AttributeError on import.
Brett Cannon added the comment: I think I would need to see exactly how you want the bytecode to change and then think over any backwards-compatibility issues since this is doesn't come up very often. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23203 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16192] ctypes - documentation example
Berker Peksag added the comment: It's not correct that [The c_int] type is an alias for the c_long type on 32-bit systems. Actually it's an alias if int and long are the same size. It's already documented at https://docs.python.org/dev/library/ctypes.html#ctypes.c_int On platforms where sizeof(int) == sizeof(long) it is an alias to c_long. Do you want to write a patch to update the original note? -- nosy: +berker.peksag stage: - needs patch status: closed - open versions: +Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16192 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22411] Embedding Python on Windows
Steve Dower added the comment: Yeah, unfortunately the only correct way to do this is to use a debug build of Python. It isn't that difficult to build, but it is extra work and may not be an option at all depending on context (for example, some businesses won't let employees access source code to open-source projects). If you link against python3.dll rather than python34.dll (there's a pre-processor variable to set, but I don't remember it off the top of my head) then you should avoid most of the debug/non-debug issues. I think you'll still need the #undef _DEBUG code though, and you'll lose access to some functionality, so it may not be an appropriate solution for you. I don't think there's any good fix for this for 3.4, short of someone building and releasing a debug build from the same changeset as the actual release. For 3.5 I may be able to add an installer option to install debug binaries alongside the release ones. I'll put some thought into it and try some things out. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22411 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22992] Adding a git developer's guide to Mercurial to devguide
Brett Cannon added the comment: If Antoine or Ezio don't make any more comments or commit this themselves then I will take the patch as-is and commit it next Friday. Sorry for the delay, Demian, but December is always a slow month due to holidays. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22992 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22992] Adding a git developer's guide to Mercurial to devguide
Demian Brecht added the comment: Thanks for the response Brett and no worries, the delay is totally understandable. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22992 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22411] Embedding Python on Windows
Joakim Karlsson added the comment: A complicating factor is that the debug and release versions of the dll:s seem to behave differently, which makes it hard to replace one with the other. For instance, in dynload_win.c, the suffix of files looked for are _d.pyd in debug mode and .pyd in release mode. This causes python not to find any .pyd files if I link to the debug version. This might be a separate issue, but it is tighly connected to this as the _DEBUG setting of the embedding app changes how the Python interpreter works. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22411 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23210] clarify virtual sequence and range docs
R. David Murray added the comment: I agree with Guido. Virtual is an abused word and I can't imagine anyone searching on it unless they saw it used somewhere in the first place. Range is a sequence, and the help docs are just a reminder. The Range docs clearly explain the advantages of the range type. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23210 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23211] test.test_logging.SMTPHandlerTest failing on Snow Leopard
New submission from Geoffrey Spear: This seems to be related to issue20605 where _socket.getaddrinfo() mysteriously fails on some Snow Leopard systems but not others; I don't think the cause of that one was ever explained but this appears to be the same error: == ERROR: test_basic (test.test_logging.SMTPHandlerTest) -- Traceback (most recent call last): File /Users/geoff/Documents/programming/cpython/Lib/test/test_logging.py, line 930, in test_basic sockmap) File /Users/geoff/Documents/programming/cpython/Lib/test/test_logging.py, line 687, in __init__ decode_data=True) File /Users/geoff/Documents/programming/cpython/Lib/smtpd.py, line 654, in __init__ type=socket.SOCK_STREAM) File /Users/geoff/Documents/programming/cpython/Lib/socket.py, line 730, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 8] nodename nor servname provided, or not known -- components: Macintosh, Tests messages: 233779 nosy: geoffreyspear, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: test.test_logging.SMTPHandlerTest failing on Snow Leopard type: behavior versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23211 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23212] Update Windows and OS X installer copies of OpenSSL to 1.0.1k
New submission from Ned Deily: https://www.openssl.org/news/secadv_20150108.txt -- components: Build, Macintosh, Windows messages: 233780 nosy: ned.deily, ronaldoussoren, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: Update Windows and OS X installer copies of OpenSSL to 1.0.1k versions: Python 2.7, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23212 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23209] asyncio: break some cycles
Roundup Robot added the comment: New changeset 376c5398f28d by Victor Stinner in branch '3.4': Issue #23209: Break some reference cycles in asyncio. Patch written by Martin https://hg.python.org/cpython/rev/376c5398f28d -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23209 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23209] asyncio: break some cycles
STINNER Victor added the comment: Hi Martin, thanks for the patch. It looks good to me. I applied it to Tulip, Python 3.4 and Python 3.5. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23209 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23210] remove the word virtual from help(range)
Roundup Robot added the comment: New changeset 79f33147949b by Benjamin Peterson in branch '3.4': remove buzzword (closes #23210) https://hg.python.org/cpython/rev/79f33147949b New changeset 154ae3af0317 by Benjamin Peterson in branch 'default': merge 3.4 (#23210) https://hg.python.org/cpython/rev/154ae3af0317 -- nosy: +python-dev resolution: - fixed stage: needs patch - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23210 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23209] asyncio: break some cycles
Roundup Robot added the comment: New changeset 7438f2e30908 by Victor Stinner in branch '3.4': Issue #23209: Revert change on selectors, test_selectors failed. https://hg.python.org/cpython/rev/7438f2e30908 New changeset 27cbc877447b by Victor Stinner in branch 'default': (Merge 3.4) Issue #23209: Revert change on selectors, test_selectors failed. https://hg.python.org/cpython/rev/27cbc877447b -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23209 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23209] asyncio: break some cycles
STINNER Victor added the comment: Ooops, test_selectors fails because get_key() raises TypeError: 'NoneType' object is not subscriptable when the selector is closed. A different fix should be written. I'm now using tox to run the Tulip test suite, I'm surprised that I didn't notice the failure. It looks like test_selectors is not executed. runtests.py searchs for test classes with a name ending with Tests. I will fix that. -- resolution: fixed - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23209 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23212] Update Windows and OS X installer copies of OpenSSL to 1.0.1k
Roundup Robot added the comment: New changeset a216f349771b by Ned Deily in branch '2.7': Issue #23212: Update OS X installer build OpenSSL to 1.0.1k. https://hg.python.org/cpython/rev/a216f349771b New changeset 849ec86651b4 by Ned Deily in branch '2.7': Issue #23212: 2.7-specific OS X installer updates https://hg.python.org/cpython/rev/849ec86651b4 New changeset ce3028357f8b by Ned Deily in branch '3.4': Issue #23212: Update OS X installer build OpenSSL to 1.0.1k. https://hg.python.org/cpython/rev/ce3028357f8b New changeset 726d67a7ebf2 by Ned Deily in branch '3.4': Issue #23212: 3.4-specific OS X installer updates https://hg.python.org/cpython/rev/726d67a7ebf2 New changeset 6d518aa5e1a2 by Ned Deily in branch 'default': Issue #23212: merge from 3.4 https://hg.python.org/cpython/rev/6d518aa5e1a2 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23212 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23205] Unit test needed for IDLE's GrepDialog.py's findfiles()
New submission from Al Sweigart: GrepDialog.py's findfiles() method lacks a unit test. The comments in the unit test stub in test_grep.py correctly notes that since findfiles() method does not rely on the GrepDialog class, it can be made into a function. The attached patch does the following: - Moves findfiles() to be a function in the GrepDialog.py module. - Adds a unit test for findfiles() - Adds sensible default arguments - As suggested by the previous stub comments, findfiles() returns a generator instead of a full list - Changes 'list' and 'dir' names since those are built-ins - Uses os.walk() instead of reinventing it. There were so many changes to make that I eventually just rewrote the entire findfiles function. I've checked that the new version returns the same strings as the old version. -- components: IDLE files: idle_grep_findfiles_test.diff keywords: patch messages: 233727 nosy: Al.Sweigart priority: normal severity: normal status: open title: Unit test needed for IDLE's GrepDialog.py's findfiles() versions: Python 3.5 Added file: http://bugs.python.org/file37652/idle_grep_findfiles_test.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23205 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23201] Decimal(0)**0 is an error, 0**0 is 1, but Decimal(0) == 0
Mark Dickinson added the comment: This behavior seems to be required by the General Decimal Arithmetic Specification (http://speleotrove.com/decimal/daexcep.html ) Yes, exactly. The decimal module strictly follows that specification. I don't like the 0**0 - NaN result much either (especially when we also have inf**0 - 1), but it's what's specified. I've talked to Mike Cowlishaw (the author of the specification) about this particular issue, and the spec is not likely to change on this point. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23201 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23119] Remove unicode specialization from set objects
Raymond Hettinger added the comment: I'm withdrawing this one. After more work trying many timings on multiple compilers and various sizes and kinds of datasets, it appears that the unicode specialization is still worth it. The cost of the lookup indirection appears to be completely insignificant (i.e. doesn't harm the non-unicode case) while the benefits of the unicode specialized lookup does have measurable benefits in the use case of deduping an iterable of strings. -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23119 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23203] Aliasing import of sub-{module, package} from the package raises AttributeError on import.
Nick Coghlan added the comment: You can see the difference between the two cases in the bytecode: dis.dis(import x.y.z) 1 0 LOAD_CONST 0 (0) 3 LOAD_CONST 1 (None) 6 IMPORT_NAME 0 (x.y.z) 9 STORE_NAME 1 (x) 12 LOAD_CONST 1 (None) 15 RETURN_VALUE dis.dis(import x.y.z as bar) 1 0 LOAD_CONST 0 (0) 3 LOAD_CONST 1 (None) 6 IMPORT_NAME 0 (x.y.z) 9 LOAD_ATTR1 (y) 12 LOAD_ATTR2 (z) 15 STORE_NAME 3 (bar) 18 LOAD_CONST 1 (None) 21 RETURN_VALUE The aliased version needs to bind the innermost object immediately, so it fails, since foo.bar doesn't get set until *after* the import is finished. The version without the alias succeeeds, as it doesn't attempt to eagerly access the attribute before it gets set by the interpreter. To better handle a similar situation with eager attribute lookups during import, issue 17636 changed IMPORT_FROM to fall back to looking at sys.modules when a module attribute it is looking for is missing. Brett, Eric, perhaps it would be worth changing the bytecode emitted in the import x.y.z as name case to match that for from x.y import x as name? dis.dis(from x.y import z as bar) 1 0 LOAD_CONST 0 (0) 3 LOAD_CONST 1 (('z',)) 6 IMPORT_NAME 0 (x.y) 9 IMPORT_FROM 1 (z) 12 STORE_NAME 2 (bar) 15 POP_TOP 16 LOAD_CONST 2 (None) 19 RETURN_VALUE -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23203 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20160] broken ctypes calling convention on MSVC / 64-bit Windows (large structs)
Robert Kuska added the comment: This commit (probably) breaks aarch64 python build. See https://bugzilla.redhat.com/show_bug.cgi?id=1174037 Build was done with libffi 3.1.6, I have also tried with latest upstream libffi version with same result. (gdb) b ReturnRect Function ReturnRect not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (ReturnRect) pending. (gdb) run test_win32.py Starting program: /usr/bin/python test_win32.py Missing separate debuginfos, use: debuginfo-install glibc-2.20.90-12.fc22.aarch64 [Thread debugging using libthread_db enabled] Using host libthread_db library /lib64/libthread_db.so.1. Breakpoint 1, ReturnRect (i=0, ar=..., br=0x59b750, cp=..., dr=..., er=0x59b750, fp=..., gr=error reading variable: Cannot access memory at address 0x) at /usr/src/debug/Python-2.7.9/Modules/_ctypes/_ctypes_test.c:552 552 if (ar.left + br-left + dr.left + er-left + gr.left != left * 5) (gdb) p fp $1 = {x = 4396722194992, y = 5879632} (gdb) p cp $2 = {x = 15, y = 25} (gdb) -- nosy: +rkuska ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20160 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19051] Unify buffered readers
Martin Panter added the comment: For what it’s worth, it would be better if compressed streams did limit the amount of data they decompressed, so that they are not susceptible to decompression bombs; see Issue 15955. But having a flexible-sized buffer could be useful in other cases. I haven’t looked closely at the code, but I wonder if there is much difference from the existing BufferedReader. Perhaps just that the underlying raw stream in this case can deliver data in arbitrary-sized chunks, but BufferedReader expects its raw stream to deliver data in limited-sized chunks? If you exposed the buffer it could be useful to do many things more efficiently: * readline() with custom newline or end-of-record codes, solving Issue 1152248, Issue 17083 * scan the buffer using string operations or regular expressions etc, e.g. to skip whitespace, read a run of unescaped symbols * tentatively read data to see if a keyword is present, but roll back if the data doesn’t match the keyword -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19051 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23207] logging.basicConfig does not validate keyword arguments
New submission from Florian Bruhin: logging.basicConfig uses **kwargs and does not validate them. This caused me to shoot myself in the foot multiple times by passing logLevel instead of level accidentally, and then trying to figure out why my messages don't get logged. -- messages: 233756 nosy: The Compiler, vinay.sajip priority: normal severity: normal status: open title: logging.basicConfig does not validate keyword arguments type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23207 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23193] Please support numeric_owner in tarfile
Berker Peksag added the comment: The patch also needs documentation update for TarFile.extract(): https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extract The tarfile documentation is located at Doc/library/tarfile.rst. -- nosy: +berker.peksag ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23193 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20160] broken ctypes calling convention on MSVC / 64-bit Windows (large structs)
Steve Dower added the comment: This change only has an effect of you're building with Visual Studio and our fork of libffi. You seem to have an unrelated issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20160 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17003] Unification of read() and readline() argument names
Martin Panter added the comment: Is there anything left for this bug or could it be closed? I can confirm my v3.4.2 docs say “size” instead of “n” :) -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17003 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5811] io.BufferedReader.peek(): Documentation differs from Implementation
Martin Panter added the comment: Is the current documentation as accurate as it can be? “The number of bytes returned may be less or more than requested” To me this has always made this method practically useless. A valid implementation could just always return b. I noticed the BZ2File.peek() documentation (BZ2File is apparently trying to imitate BufferedReader) is slightly more useful: “At least one byte of data will be returned (unless at EOF)” That could be used for (say) peeking for a LF following a CR. But still the “size” parameter does not seem very useful. In fact, LZMAFile.peek() says the size is ignored. -- nosy: +vadmium versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5811 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23206] json.dumps(ensure_ascii=False) is ~10x slower than json.dumps()
New submission from INADA Naoki: I prefer ensure_ascii=False because it's efficient. But I notice it is very slower. On Python 3.4.2: In [3]: %timeit json.dumps([{'hello': 'world'}]*100) 1 loops, best of 3: 74.8 µs per loop In [4]: %timeit json.dumps([{'hello': 'world'}]*100, ensure_ascii=False) 1000 loops, best of 3: 259 µs per loop On Python HEAD with attached patch: In [2]: %timeit json.dumps([{'hello': 'world'}]*100) 1 loops, best of 3: 80.8 µs per loop In [3]: %timeit json.dumps([{'hello': 'world'}]*100, ensure_ascii=False) 1 loops, best of 3: 80.4 µs per loop -- components: Library (Lib) files: json-fast-unicode-encode.patch keywords: patch messages: 233752 nosy: naoki priority: normal severity: normal status: open title: json.dumps(ensure_ascii=False) is ~10x slower than json.dumps() versions: Python 3.5 Added file: http://bugs.python.org/file37653/json-fast-unicode-encode.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23206 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23201] Decimal(0)**0 is an error, 0**0 is 1, but Decimal(0) == 0
Stefan Krah added the comment: The behavior is already documented (power function): at least one of x or y must be nonzero The decimal docs are already so large that it is probably a bad idea to add a warning. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23201 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16192] ctypes - documentation example
eryksun added the comment: It's not correct that [The c_int] type is an alias for the c_long type on 32-bit systems. Actually it's an alias if int and long are the same size. Here's the relevant snippet from __init__: if _calcsize(i) == _calcsize(l): # if int and long have the same size, make c_int an alias for c_long c_int = c_long c_uint = c_ulong else: class c_int(_SimpleCData): _type_ = i _check_size(c_int) class c_uint(_SimpleCData): _type_ = I _check_size(c_uint) Notably, int and long are the same size on 64-bit Windows: sizeof(c_void_p) # 64-bit 8 c_int class 'ctypes.c_long' sizeof(c_long) 4 -- nosy: +eryksun ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16192 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23206] json.dumps(ensure_ascii=False) is ~10x slower than json.dumps()
INADA Naoki added the comment: I've copied test_encode_basestring_ascii.py and modify it for this patch. -- Added file: http://bugs.python.org/file37654/test_encode_basestring.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23206 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22038] Implement atomic operations on non-x86 platforms
Gustavo Temple added the comment: Thank you, Victor! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22038 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23046] asyncio.BaseEventLoop is documented, but only exported via asyncio.base_events
STINNER Victor added the comment: See also the Documentation: document AbstractServer, Server.sockets is specific to asyncio event loops issue: https://code.google.com/p/tulip/issues/detail?id=188 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23046 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17003] Unification of read() and readline() argument names
Serhiy Storchaka added the comment: readlines() parameter name is not unified still (it can be hint, size, sizehint). There is no obvious winner. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17003 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23206] json.dumps(ensure_ascii=False) is ~10x slower than json.dumps()
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +ezio.melotti, pitrou, rhettinger, serhiy.storchaka stage: - patch review type: - performance ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23206 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com