[issue15809] IDLE console uses incorrect encoding.
Serhiy Storchaka added the comment: Use cp1256 encoding in your source file. It is expected that usually your source files encoding is same as your locale encoding. In such case printing string literals and Unicode string literals produces same result (as they look in the sources). s1 is '\xd8\xb3\xd9\x84\xd8\xa7\xd9\x85' (u'سلام'.encode('utf-8')) and when it printed in utf-8 locale it produces سلام, but when it printed in cp1256 locale it produces a mojibake. When you convert your source file to cp1256 and change a header, s1 will be '\xd3\xe1\xc7\xe3' (u'سلام'.encode('cp1256')) and will produce سلام when printed in your cp1256 locale. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15809 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16685] Deprecate accepting strings as arguments in audioop functions
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16685 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
STINNER Victor added the comment: The surrogateescape error handler works with any codec. The surrogatepass only works with utf-8 if I remember correctly. The surrogateescape error handler works with any codec, especially ascii. As a side effect of this change an input from stdin will be incompatible in general with extensions which implicitly encode a string to bytes with UTF-8 (e.g. tkinter, XML parsers, sqlite3, datetime, locale, curses, etc.) Correct, but it's not something new: os.listdir(), sys.argv, os.environ and other functions using os.fsdecode(). Applications should already have to support surrogates. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18799] Resurrect and fix test_404 in Lib/test/test_xmlrpc.py
Vajrasky Kok added the comment: Yes, I agree with you, R. David Murray. But there are some reasons why I try to resurrect this dormant test: 1. This test was disabled on 19 January 2008. http://hg.python.org/cpython/rev/859bf85a556a It has been more than 5 years. Many things happened. 2. In the last commit about this test, they used httplib not http library to access the server. If you see this commit: http://hg.python.org/cpython/rev/5756b295b6fb , the intuition (at least my intuition) suggests that the similar way can be applied to the dormant test. This commit is in 2012. 3. The http server in the test_xmlrpc.py differs than the http server 5 years ago. But again, you are maybe right. So let's hear from the person who disabled this test. Christian Heimes, what do you say about this ticket? -- nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18799 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18806] socketmodule: fix/improve setipaddr() numeric addresses handling
Charles-François Natali added the comment: Hum... Apparently, before this bug was fixed, glibc's getaddrinfo() would retrieve the list of interfaces at every call, even if AI_ADDRCONFIG was not set: http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fa3fc0fe5f452d0aa7e435d8f32e992958683819 Which can mean a large overhead. Also, from a quick look at the source, it will also retrieve the list of interfaces if more than one address matches (e.g. for TCP, UDP, or if AF_UNSPEC is passed). So using getaddrinfo() could incur a non-negligible overhead. So it might be better to just use inet_pton() instead. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18806 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15204] Deprecate the 'U' open mode
Serhiy Storchaka added the comment: Here is an updated patch. I think we can combine 1 and 2 stages (change the documentation and add warnings). -- Added file: http://bugs.python.org/file31416/deprecate-U-mode.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15204 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
Serhiy Storchaka added the comment: The surrogateescape error handler works with any codec. Ah, sorry. You are correct. Correct, but it's not something new: os.listdir(), sys.argv, os.environ and other functions using os.fsdecode(). Applications should already have to support surrogates. I'm only saying that this will increase a number of cases when an exception will raised in unexpected place. Perhaps it will be safe left the strict default error handler and make the errors attribute of text streams modifiable. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
STINNER Victor added the comment: I'm only saying that this will increase a number of cases when an exception will raised in unexpected place. The print() instruction is much more common than input(). IMO changing the error handle should fix more issues than adding regressions. Python functions decoding OS data from the filesystem encoding with surrogateescape: - sys.thread_info.version - sys.argv - os.environ, os.getenv() - os.fsdecode() - _ssl._SSLSocket.compression - os.ttyname(), os.ctermid(), os.getcwd(), os.listdir(), os.uname(), os.getlogin(), os.readlink(), os.confstr(), os.listxattr(), nis.cat() - grp.getgrpgid(), grp.getgrpnam(), grp.getgrpall() - spwd.spwd_getspnam(), spwd.spwd_getspall() - pwd.getpwuid(), pwd.getpwnam(), pwd.getpwall() - socket.socket.accept(), socket.socket.getsockname(), socket.socket.getpeername(), socket.socket.recvfrom(), socket.gethostname(), socket.if_nameindex(), socket.if_indextoname() -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
Serhiy Storchaka added the comment: Shouldn't be safer use surrogateescape for output and strict for input. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18806] socketmodule: fix/improve setipaddr() numeric addresses handling
Charles-François Natali added the comment: So it might be better to just use inet_pton() instead. But then it won't set the scope ID if the user doesn't provide it... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18806 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16700] Document that bytes OS API can returns unusable results on Windows
Changes by Serhiy Storchaka storch...@gmail.com: -- versions: -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16700 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
STINNER Victor added the comment: Serhiy Storchaka added the comment: Shouldn't be safer use surrogateescape for output and strict for input. Nick wrote Think sysadmins running scripts on Linux, writing to the console or a pipe. See my message msg195769: Python3 cannot be simply used as a pipe because it wants to be kind by decoding binary data to Unicode, whereas no everybody cares of Unicode :-) Hum, I realized that the subprocess should also be patched to be consistent: subprocess already uses surrogateescape for the command line arguments and environment variables, why not using the same error handler for stdin, stdout and stderr? Serhiy Storchaka also noticed (in the review of my patch) than errors is strict when PYTHONIOENCODING=utf-8 is used. We should also use surrogateescape if only the encoding is changed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
Antoine Pitrou added the comment: See my message msg195769: Python3 cannot be simply used as a pipe because it wants to be kind by decoding binary data to Unicode, whereas no everybody cares of Unicode :-) If somebody doesn't care about unicode, they can use sys.stdin.buffer. Problem solved :-) Note: enabling surrogateescape on stdin enables precisely the exception being raised far from the source of the problem people are afraid of. surrogateescape on stdin allows invalid unicode strings to slip into your application, only for a later encoding to utf-8 to fail (since lone surrogates are not allowed). For example if you are sending that user data over an utf-8 network protocol (perhaps JSON-encoded or XML-encoded)... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
Antoine Pitrou added the comment: Serhiy Storchaka also noticed (in the review of my patch) than errors is strict when PYTHONIOENCODING=utf-8 is used. We should also use surrogateescape if only the encoding is changed. I don't understand what you say. Could you rephrase? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
STINNER Victor added the comment: Serhiy Storchaka also noticed (in the review of my patch) than errors is strict when PYTHONIOENCODING=utf-8 is used. We should also use surrogateescape if only the encoding is changed. I don't understand what you say. Could you rephrase? With my patch, sys.stdin.errors is surrogateescape by default, but it is strict when the PYTHONIOENCODING environment variable is set to utf-8. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
Antoine Pitrou added the comment: Is it a bug in your patch, or is it deliberate? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15204] Deprecate the 'U' open mode
Vajrasky Kok added the comment: http://bugs.python.org/review/15204/diff/9032/Tools/iobench/iobench.py Line 10 in New: import io But io module is never used. -- nosy: +vajrasky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15204 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18762] error in test_multiprocessing_forkserver
Roundup Robot added the comment: New changeset a94555d5070f by Richard Oudkerk in branch 'default': Issue #18762: Fix EBADF error when using forkserver. http://hg.python.org/cpython/rev/a94555d5070f -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18762 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18747] Re-seed OpenSSL's PRNG after fork
Roundup Robot added the comment: New changeset 39c9dbed3aa1 by Christian Heimes in branch '3.3': Issue #18747: Use a parent atfork handler instead of a child atfork handler. http://hg.python.org/cpython/rev/39c9dbed3aa1 New changeset 25e05147d662 by Christian Heimes in branch 'default': Issue #18747: Use a parent atfork handler instead of a child atfork handler. http://hg.python.org/cpython/rev/25e05147d662 New changeset d542f905081a by Christian Heimes in branch '2.7': Issue #18747: Use a parent atfork handler instead of a child atfork handler. http://hg.python.org/cpython/rev/d542f905081a New changeset 6ec43643c54f by Christian Heimes in branch '3.3': Issue #18747: Update Misc/NEWS to reflect the latest changeset. http://hg.python.org/cpython/rev/6ec43643c54f New changeset 956261a143eb by Christian Heimes in branch 'default': Issue #18747: Update Misc/NEWS to reflect the latest changeset. http://hg.python.org/cpython/rev/956261a143eb New changeset 14490ced507e by Christian Heimes in branch '2.7': Issue #18747: Update Misc/NEWS to reflect the latest changeset. http://hg.python.org/cpython/rev/14490ced507e -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18747 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
STINNER Victor added the comment: Is it a bug in your patch, or is it deliberate? It was not deliberate, and I think that it would be more consistent to use the same error handler (surrogateescape) when only the encoding is changed by the PYTHONIOENCODING environment variable. So surrogateescape should be used even with PYTHONIOENCODING=utf-8. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15806] Add context manager for the try: ... except: pass pattern
Yury V. Zaytsev added the comment: Hi Raymond, This is a brilliant idea, but before it hits the streets, couldn't you possibly consider extending it with a kwarg to control the depth of the exception stack? The use case I have for that are snippets like this: with ignored(ValueError, TypeError), ignored(ValueError, TypeError), ignored(ValueError, TypeError): a() b() c() Or else I could write this as with ignored(ValueError, TypeError): a() with ignored(ValueError, TypeError): b() with ignored(ValueError, TypeError): c() ... but either way it looks bad. This looks a bit better to me: with ignored(ValueError, TypeError, depth=3): a() b() c() If you deem this to be unacceptably unpythonic, then please ignore my suggestion. -- nosy: +zaytsev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15806 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18606] Add statistics module to standard library
Oscar Benjamin added the comment: On 22 August 2013 03:43, Steven D'Aprano rep...@bugs.python.org wrote: If Oscar is willing, I'd like to discuss some of his ideas off-list, but that may take some time. I am willing and it will take time. I've started reading the paper that Raymond Hettinger references for the algorithm used in his accurate float sum recipe. I'm not sure why yet but the algorithm is apparently provably exact only for binary radix floats so isn't appropriate for decimals. It does seem to give *very* accurate results for decimals though so I suspect the issue is just about cases that are on the cusp of the rounding mode. In any case the paper cites a previous work that gives an algorithm that apparently works for floating point types with arbitrary radix and exact rounding; it would be good for that to live somewhere in Python but I haven't had a chance to look at the paper yet. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18606 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18762] error in test_multiprocessing_forkserver
Richard Oudkerk added the comment: Hopefully this is fixed now. -- resolution: - fixed stage: - committed/rejected status: open - closed type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18762 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
Serhiy Storchaka added the comment: The surrogateescape error handler is dangerous with utf-16/32. It can produce globally invalid output. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18807] Allow venv to create copies, even when symlinks are supported
New submission from Andrea Corbellini: I'd really appreciate if `venv` could create environments without symlinks. Working on many Python projects, each one with different requirements, I prefer to keep everything I need in a single virtualenv directory, rather than two (one for the virtualenv and one for the built Python). So I'd like to have a --copies option that lets me force venv not to create symlinks. I can work on a patch if this issue is accepted. -- components: Library (Lib) messages: 195883 nosy: candrea priority: normal severity: normal status: open title: Allow venv to create copies, even when symlinks are supported versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18807 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18747] Re-seed OpenSSL's PRNG after fork
Vajrasky Kok added the comment: Some typos on last commit current time (miliseconds or seconds) and an uninitialized arry. should be current time (miliseconds or seconds) and an uninitialized array. instead of a child handler because fork() is suppose to be async-signal should be instead of a child handler because fork() is supposed to be async-signal A pthread_atfork() parent handler is used to seeded the PRNG with pid, time should be A pthread_atfork() parent handler is used to seed the PRNG with pid, time -- nosy: +vajrasky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18747 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18747] Re-seed OpenSSL's PRNG after fork
Christian Heimes added the comment: Thanks, that's embarrassing. :( I'm going to install a spell checker ... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18747 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
STINNER Victor added the comment: The surrogateescape error handler is dangerous with utf-16/32. It can produce globally invalid output. I don't understand, can you give an example? surrogateescape generate invalid encoded string with any encoding. Example with UTF-8: ba\xffb.decode(utf-8, surrogateescape) 'a\udcffb' 'a\udcffb'.encode(utf-8, surrogateescape) b'a\xffb' b'a\xffb'.decode(utf-8) Traceback (most recent call last): File stdin, line 1, in module UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 1: invalid start byte So str.encode(utf-8, surrogateescape) produces an invalid UTF-8 sequence. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18747] Re-seed OpenSSL's PRNG after fork
STINNER Victor added the comment: PySSL_RAND_atfork_parent() still uses getpid(). This number is not very random in the *parent* process :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18747 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18747] Re-seed OpenSSL's PRNG after fork
Charles-François Natali added the comment: STINNER Victor added the comment: PySSL_RAND_atfork_parent() still uses getpid(). This number is not very random in the *parent* process :-) :-) IMO this patch has been rushed in and should be reverted for now. It's still not async-signal safe, had typos, plus this problem noted by Victor. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18747 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18747] Re-seed OpenSSL's PRNG after fork
STINNER Victor added the comment: IMO this patch has been rushed in and should be reverted for now. Agreed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18747 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18800] Document Fraction's numerator and denominator properties
Changes by Alexander Belopolsky alexander.belopol...@gmail.com: -- nosy: +belopolsky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11245] Implementation of IMAP IDLE in imaplib?
Changes by Daniël van Eeden launch...@myname.nl: -- nosy: +dveeden ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11245 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18540] imaplib.IMAP4() ends with Name or service not known on Fedora 18
Changes by Daniël van Eeden launch...@myname.nl: -- nosy: +dveeden ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18540 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15806] Add context manager for the try: ... except: pass pattern
Yury V. Zaytsev added the comment: Actually, please disregard my idea. It's way to dangerous, especially in the case of multiple exceptions to ignore :-( -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15806 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18808] Thread.join returns before PyThreadState is destroyed
New submission from Tamas K: When a thread is started in CPython, t_bootstrap [Modules/threadmodule.c] creates a PyThreadState object and then calls Thread.__bootstrap_inner [Lib/threading.py] which calls Thread.run, protected with self.__block, a Condition. Thread.join uses the same __block to block until Thread.run finished. When Thread.run finished, __bootstrap_inner notifies on __block, so join will return. Here lies a race condition, if a thread switch to Thread.join occures before __bootstrap_inner returns to t_bootstrap. Then join will return before the PyThreadState for the thread is destroyed by t_bootstrap. It is mostly harmless for general use, as __bootstrap_inner eventually gets scheduled again and PyThreadState is taken care of. However. Py_EndInterpreter [Python/pythonrun.c] can be called when only the main interpreter thread is running. So when we want to call Py_EndInterpreter, we signal every other thread to stop, and join them. And when Thread.join returns, we call Py_EndInterpreter. Py_EndInterpreter checks if there are any other PyThreadStates still around and does a Py_FatalError. As a workaround, we now do a sleep after join. -- components: Interpreter Core, Library (Lib) messages: 195891 nosy: Tamas.K priority: normal severity: normal status: open title: Thread.join returns before PyThreadState is destroyed type: crash versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18808 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18747] Re-seed OpenSSL's PRNG after fork
Christian Heimes added the comment: Am 22.08.2013 15:20, schrieb STINNER Victor: STINNER Victor added the comment: PySSL_RAND_atfork_parent() still uses getpid(). This number is not very random in the *parent* process :-) That's fine and doesn't diminish the properties of the PRNG. In fact the patch could use a hard coded value to perturb the PRNG. It's only important to modify the PRNG state of the *parent* process so that recycled PIDs of *child* processes don't lead to repeated pseudo-random values. PID, time and stack are just hard-to-guess properties of the process. That's all. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18747 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18800] Document Fraction's numerator and denominator properties
Changes by Serhiy Storchaka storch...@gmail.com: -- keywords: +easy nosy: +mark.dickinson, rhettinger stage: - needs patch versions: +Python 2.7, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18808] Thread.join returns before PyThreadState is destroyed
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +pitrou stage: - test needed versions: +Python 3.4 -Python 2.6, Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18808 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18747] Re-seed OpenSSL's PRNG after fork
Christian Heimes added the comment: Yet another good blog post about the issue: OpenSSL PRNG Is Not (Really) Fork-safe http://emboss.github.io/blog/2013/08/21/openssl-prng-is-not-really-fork-safe/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18747 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18808] Thread.join returns before PyThreadState is destroyed
Tamas K added the comment: The bug was found in 2.6.5, but after a quick eyeballing, current HEAD has the same problem. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18808 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
Serhiy Storchaka added the comment: ('\udcff' + 'qwerty').encode('utf-16le', 'surrogateescape') b'\xff\xdcq\x00w\x00e\x00r\x00t\x00y\x00' ('\udcff' + 'qwerty').encode('utf-16le', 'surrogateescape').decode('utf-16le', 'surrogateescape') '\udcff\udcdcqwerty' ('\udcff' + 'qwerty').encode('utf-16le', 'surrogateescape').decode('utf-16le', 'surrogateescape').encode('utf-16le', 'surrogateescape') b'\xff\xdc\xdc\xdcq\x00w\x00e\x00r\x00t\x00y\x00' ('\udcff' + 'qwerty').encode('utf-16le', 'surrogateescape').decode('utf-16le', 'surrogateescape').encode('utf-16le', 'surrogateescape').decode('utf-16le', 'surrogateescape') '\udcff\udcdc\udcdc\udcdcqwerty' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12641] Interface
Travis added the comment: Interface -- nosy: +honorableinvasi title: Remove -mno-cygwin from distutils - Interface Added file: http://bugs.python.org/file31417/test2.html ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12641 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
Nick Coghlan added the comment: Note that the specific case I'm really interested is printing on systems that are properly configured to use UTF-8, but are getting bad metadata from an OS API. I'm OK with the idea of *only* changing it for UTF-8 rather than for arbitrary encodings, as well as restricting it to sys.stdout when the codec used matches the default filesystem encoding. To double check the current behaviour, I created a directory to tinker with this. Filenames were created with the following: open(ℙƴ☂ℌøἤ.encode(utf-8), w) open(basic_ascii.encode(utf-8), w) b\xd0\xd1\xd2\xd3.decode(latin-1) 'ÐÑÒÓ' open(b\xd0\xd1\xd2\xd3, w) That last generates an invalid UTF-8 filename. ls actually degrades less gracefully than I thought, and just prints question marks for the bad file: $ ls -l total 0 -rw-rw-r--. 1 ncoghlan ncoghlan 0 Aug 23 00:04 -rw-rw-r--. 1 ncoghlan ncoghlan 0 Aug 23 00:01 basic_ascii -rw-rw-r--. 1 ncoghlan ncoghlan 0 Aug 23 00:01 ℙƴ☂ℌøἤ Python 2 3 both work OK if you just print the directory listing directly, since repr() happily displays the surrogate escaped string: $ python -c import os; print(os.listdir('.')) ['basic_ascii', '\xd0\xd1\xd2\xd3', '\xe2\x84\x99\xc6\xb4\xe2\x98\x82\xe2\x84\x8c\xc3\xb8\xe1\xbc\xa4'] $ python3 -c import os; print(os.listdir('.')) ['basic_ascii', '\udcd0\udcd1\udcd2\udcd3', 'ℙƴ☂ℌøἤ'] Where it falls down is when you try to print the strings directly in Python 3: $ python3 -c import os; [print(fname) for fname in os.listdir('.')] basic_ascii Traceback (most recent call last): File string, line 1, in module File string, line 1, in listcomp UnicodeEncodeError: 'utf-8' codec can't encode character '\udcd0' in position 0: surrogates not allowed While setting the IO encoding produces behaviour closer to that of the native tools: $ PYTHONIOENCODING=utf-8:surrogateescape python3 -c import os; [print(fname) for fname in os.listdir('.')] basic_ascii ℙƴ☂ℌøἤ On the other hand, setting PYTHONIOENCODING as shown provides an environmental workaround, and http://bugs.python.org/issue15216 will provide an improved programmatic workaround (which tools like http://code.google.com/p/pyp/ could use to configure surrogateescape by default). So perhaps pursuing #15216 further would be a better approach than selectively changing the default behaviour? And better documentation for ways to handle the surrogate escape error when it arises? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18809] Expose mtime check in importlib.machinery.FileFinder
New submission from Brett Cannon: If you have enough control over your environment you really don't need to waste a stat call checking if the directory has been modified. That makes the idea of having the check of whether the directory has changed be exposed publicly a useful idea (code: http://hg.python.org/cpython/file/caf72b44240b/Lib/importlib/_bootstrap.py#l1387). Maybe a check_mtime(old_mtime) where we guarantee that old_mtime is negative if this is the first check? That way the _path_mtime stays private but the check itself is exposed for people to do things like ``return 0`` so that the cache is built once on first use of find_loader() but otherwise never re-calculated. -- components: Library (Lib) messages: 195898 nosy: brett.cannon priority: normal severity: normal status: open title: Expose mtime check in importlib.machinery.FileFinder versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18809 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16809] Tk 8.6.0 introduces TypeError. (Tk 8.5.13 works)
Roundup Robot added the comment: New changeset 6b841e1ee3b8 by Serhiy Storchaka in branch '3.3': Issue #16809: Tkinter's splitlist() and split() methods now accept Tcl_Obj http://hg.python.org/cpython/rev/6b841e1ee3b8 New changeset 85285e6e28f4 by Serhiy Storchaka in branch 'default': Issue #16809: Tkinter's splitlist() and split() methods now accept Tcl_Obj http://hg.python.org/cpython/rev/85285e6e28f4 New changeset 2d96764a66fa by Serhiy Storchaka in branch '2.7': Issue #16809: Tkinter's splitlist() and split() methods now accept Tcl_Obj http://hg.python.org/cpython/rev/2d96764a66fa -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16809 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18809] Expose mtime check in importlib.machinery.FileFinder
Changes by Brett Cannon br...@python.org: -- stage: - test needed type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18809 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18810] Stop doing stat calls in importlib.machinery.FileFinder to see if something is a file or folder
New submission from Brett Cannon: If the check was done based on simply the format what was being searched for (e.g. just assume it's a file if module.py exists in the directory) then a couple of stat calls per search could be saved. If that is deemed to dangerous due to backwards-compatibility, at least extract an API so people can skip the stat calls if they know they are not going to do something as silly as have something named module.py that is not a file. -- components: Library (Lib) messages: 195900 nosy: brett.cannon priority: normal severity: normal stage: test needed status: open title: Stop doing stat calls in importlib.machinery.FileFinder to see if something is a file or folder type: performance versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18810 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16809] Tk 8.6.0 introduces TypeError. (Tk 8.5.13 works)
Roundup Robot added the comment: New changeset 516b0cd87a90 by Serhiy Storchaka in branch '3.3': Issue #16809: Fixed some tkinter incompabilities with Tcl/Tk 8.6. http://hg.python.org/cpython/rev/516b0cd87a90 New changeset 5b5ef012cd4e by Serhiy Storchaka in branch 'default': Issue #16809: Fixed some tkinter incompabilities with Tcl/Tk 8.6. http://hg.python.org/cpython/rev/5b5ef012cd4e New changeset 06244031b608 by Serhiy Storchaka in branch '2.7': Issue #16809: Fixed some tkinter incompabilities with Tcl/Tk 8.6. http://hg.python.org/cpython/rev/06244031b608 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16809 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12641] Interface
Changes by Éric Araujo mer...@netwok.org: Removed file: http://bugs.python.org/file31417/test2.html ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12641 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12641] Remove -mno-cygwin from distutils
Changes by Éric Araujo mer...@netwok.org: -- title: Interface - Remove -mno-cygwin from distutils ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12641 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16809] Tk 8.6.0 introduces TypeError. (Tk 8.5.13 works)
Serhiy Storchaka added the comment: Thank you alejandro. Fixed. I'm afraid this is not all problems with 8.6 and so left this issue open. -- priority: high - critical stage: needs patch - commit review versions: -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16809 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12641] Remove -mno-cygwin from distutils
Changes by Éric Araujo mer...@netwok.org: -- Removed message: http://bugs.python.org/msg195896 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12641 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18747] Re-seed OpenSSL's PRNG after fork
Antoine Pitrou added the comment: IMO this patch has been rushed in and should be reverted for now. It's still not async-signal safe, had typos, plus this problem noted by Victor. That's not really a problem. You merely have to *perturb* the random state in the parent, so that the next child gets a different initial state. As pointed out in a mailing-list message, mixing in a constant could be enough to perturb the state. As for not being async-signal safe, it's only in the double fork() case, which is much less of an issue IMO. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18747 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18747] Re-seed OpenSSL's PRNG after fork
Charles-François Natali added the comment: PySSL_RAND_atfork_parent() still uses getpid(). This number is not very random in the *parent* process :-) That's fine and doesn't diminish the properties of the PRNG. In fact the patch could use a hard coded value to perturb the PRNG. It's only important to modify the PRNG state of the *parent* process so that recycled PIDs of *child* processes don't lead to repeated pseudo-random values. Yeah, it doesn't weaken the PRNG, but since we're using current time and stack content to reseed it, using the parent PID which doesn't change doesn't bring much (since we chose to add entropy and not just a constant, which would be sufficient as you noted). Anyway, for those interested, here's a reproducer. -- Added file: http://bugs.python.org/file31418/test.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18747 ___import os import ssl import time def get_random(): return ssl.RAND_bytes(10) get_random() refpid = os.fork() if refpid == 0: # first child print(PID: %d, random: %s % (os.getpid(), get_random())) os._exit(0) else: os.waitpid(refpid, 0) while True: pid = os.fork() if pid == refpid: os.waitpid(pid, 0) break elif pid == 0: if os.getpid() == refpid: print(PID: %d, random: %s % (os.getpid(), get_random())) os._exit(0) ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18797] Don't needlessly change refcounts of dummy objects for sets
Roundup Robot added the comment: New changeset ac6dab1819c4 by Raymond Hettinger in branch 'default': Issue 18797: Remove unneeded refcount adjustments for dummy objects. http://hg.python.org/cpython/rev/ac6dab1819c4 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18797 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18808] Thread.join returns before PyThreadState is destroyed
Antoine Pitrou added the comment: I *think* we could remove that limitation in Py_EndInterpreter(). After all, Py_Finalize() is able to join() non-daemon threads, so there's no reason for Py_EndInterpreter() to allow it too. We must keep the fatal error for daemon threads, though. As for ensuring the thread state is destroyed before Thread.join() returns, I don't know how to do it: the thread state isn't a PyObject, we can't access it from Python code. -- nosy: +grahamd, ncoghlan stage: test needed - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18808 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17803] Calling Tkinter.Tk() with a baseName keyword argument throws UnboundLocalError
Serhiy Storchaka added the comment: Fixed in changesets fa82071bb7e1 and 0f17aed78168. -- nosy: +serhiy.storchaka resolution: - duplicate stage: test needed - committed/rejected status: open - closed superseder: - Security bug in tkinter allows for untrusted, arbitrary code execution. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17803 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
R. David Murray added the comment: If you pipe the ls (eg: ls temp) the bytes are preserved. Since setting the escape handler via PYTHONIOENCODING sets it for both stdin in and stdout, it sounds like that solves the sysadmin use case. The sysadmin can just put that environment variable setting in their default profile, and python will once again work like the other unix shell tools. (I double checked, and this does indeed work...doing the equivalent of ls temp via python preserves the bytes with that PYTHONIOENCODING setting. I don't quite understand, however, why I get the � chars if I don't redirect the output.). I'd be inclined to consider the above as reason enough to close this issue. As usual with Python, explicit is better than implicit. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18808] Thread.join returns before PyThreadState is destroyed
Antoine Pitrou added the comment: (Actually, it would almost be possible to combine weakrefs and thread locals to ensure that join() only returns when the thread state is cleared. However, the thread state is cleared before it is untied from the interpreter, and there would still be a small window for a race condition if some destructor called by clearing the thread state released the GIL.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18808 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18808] Thread.join returns before PyThreadState is destroyed
Antoine Pitrou added the comment: (Of course, the latter problem can be solved by having a dedicated sentinel in the thread state that gets DECREF'efed only *after* the thread state is removed from the interpreter...) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18808 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18797] Don't needlessly change refcounts of dummy objects for sets
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18797 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18808] Thread.join returns before PyThreadState is destroyed
Tamas K added the comment: Removing the last thread check sounds good, what we actually need is a Py_EndInterpreter that does not casually abort() on us, we don't really care about PyThreadStates that much. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18808 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17119] Integer overflow when passing large string or tuple to Tkinter
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17119 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18811] add ssl-based generator to random module
New submission from Charles-François Natali: Now that the ssl module exposes RAND_bytes() (issue #12049), it might be interesting to implement a SSLRandom generator to the random module, to have a cryptographically strong generator without the os.urandom() overhead. Thoughts? -- messages: 195912 nosy: christian.heimes, haypo, neologix, pitrou priority: normal severity: normal stage: needs patch status: open title: add ssl-based generator to random module type: enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18811 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18811] add ssl-based generator to random module
Christian Heimes added the comment: I'm -1 It doesn't look like OpenSSL's PRNG is much faster than /dev/urandom if Python keeps a persistent fd: $ python3.3 prng.py loops: 100 bytes: 16 /dev/urandom (fd)1.2181 os.urandom() 3.2892 RAND_pseudo_bytes1.2924 RAND_bytes 1.2945 Some crypto experts also say that the PRNG of a stock OpenSSL build is sub par. The algorithm is neither standardized by NIST nor carefully developed by a cryptographer. FIPS builds of OpenSSL have a better PRNG. -- versions: +Python 3.4 Added file: http://bugs.python.org/file31419/prng.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18811 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18811] add ssl-based generator to random module
Charles-François Natali added the comment: It doesn't look like OpenSSL's PRNG is much faster than /dev/urandom if Python keeps a persistent fd: $ python3.3 prng.py loops: 100 bytes: 16 /dev/urandom (fd)1.2181 os.urandom() 3.2892 RAND_pseudo_bytes1.2924 RAND_bytes 1.2945 Except that your benchmark uses 4096-bytes buffering for /dev/urandom with a persistent FD, which is not the case with the implementation proposed in #issue18756. Without buffering (i.e. one read() syscall per invokation), the numbers change: $ ./python ~/prng.py loops: 10 bytes: 16 /dev/urandom (fd)1.37106 os.urandom() 1.4446 RAND_pseudo_bytes0.83635 RAND_bytes 0.75604 Also, you use CLOCK_PROCESS_CPUTIME_ID which only accounts for CPU time, not wall-clock time, but it doesn't change much. Some crypto experts also say that the PRNG of a stock OpenSSL build is sub par. The algorithm is neither standardized by NIST nor carefully developed by a cryptographer. FIPS builds of OpenSSL have a better PRNG. That's an implementation detail, it could very well improve. But I don't have a strong feeling, so if that's not deemed useful, I won't take it personally :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18811 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18812] PyImport_Import redundant calls to find module
New submission from Rob Bairos: Why does PyImport_Import (import.c) call __import__ then immediately discard the result, and then look for the module again in the module dictionary? It will return the same value in both cases no? Ive included the relevant portion of the code below. Its breaking an embedded application we've built where a hierarchy of modules are maintained outside the sys.modules dictionary. /* Call the __import__ function with the proper argument list Always use absolute import here. Calling for side-effect of import. */ r = PyObject_CallFunction(import, i, module_name, globals, globals, silly_list, 0, NULL); if (r == NULL) goto err; //-- WHY IS THIS SECTION NEEDED? Py_DECREF(r); modules = PyImport_GetModuleDict(); r = PyDict_GetItem(modules, module_name); if (r != NULL) //--- Py_INCREF(r); -- components: Interpreter Core messages: 195915 nosy: Rob.Bairos priority: normal severity: normal status: open title: PyImport_Import redundant calls to find module versions: Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18812 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18812] PyImport_Import redundant calls to find module
Changes by Rob Bairos rbai...@gmail.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18812 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16840] Tkinter doesn't support large integers
Serhiy Storchaka added the comment: Patch updated. -- Added file: http://bugs.python.org/file31420/tkinter_bignum_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18747] Re-seed OpenSSL's PRNG after fork
Barry A. Warsaw added the comment: On Aug 21, 2013, at 11:49 AM, Christian Heimes wrote: I have taken care of Antoine's and Victor's reviews. The fix has landed in Python 2.7, 3.3 and 3.4. What about 2.6, 3.1 and 3.2? After all it's a security fix (although I don't consider its severity as high). I'd like to get this into 2.6. I'll apply the patch after I fix my environment so it can actually build 2.6 with ssl enabled. I'll follow up here with status. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18747 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18813] Speed up slice object processing
New submission from Stefan Behnel: The get/set/delitem slicing protocol has replaced the old Py2.x get/set/delslice protocol in Py3.x. This change introduces a substantial overhead due to processing indices as Python objects rather than plain Py_ssize_t values. This overhead should be reduced as much as possible. This ticket can be seen as a more general follow-up to issue10227. -- components: Interpreter Core messages: 195918 nosy: pitrou, scoder priority: normal severity: normal status: open title: Speed up slice object processing type: performance versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18813 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18813] Speed up slice object processing
Stefan Behnel added the comment: This tiny patch adds a fast-path to _PyEval_SliceIndex() that speeds up the slicing-heavy fannkuch benchmark by 8% for me. -- keywords: +patch Added file: http://bugs.python.org/file31421/faster_PyEval_SliceIndex.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18813 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18813] Speed up slice object processing
Stefan Behnel added the comment: Sorry, broken patch. Here's a new one (same results). -- Added file: http://bugs.python.org/file31422/faster_PyEval_SliceIndex.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18813 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18811] add ssl-based generator to random module
STINNER Victor added the comment: Use time.perf_counter() for benchmarkks!!! It would be interesting to compare performances on other platforms: Windows, Solaris, Mac OS X, ... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18811 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18813] Speed up slice object processing
Stefan Behnel added the comment: Another patch, originally proposed in issue10227 by Kristján Valur Jónsson. It uses local variables instead of pointers in PySlice_GetIndicesEx(). I see no performance difference whatsoever (Linux/gcc 4.7), but also I can't see a reason not to do this. I think it cleans up the code a bit. -- Added file: http://bugs.python.org/file31423/use_locals_in_PySlice_GetIndicesEx.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18813 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18763] subprocess: file descriptors should be closed after preexec_fn is called
Charles-François Natali added the comment: Using self.assertLessEqual() would provide better message on error. Done. You don't want to fix Python 2.7 and 3.3? It is a bug in my opinion. Patch for 2.7 attached (without test though, because 2.7 lacks a fd_status.py helper, which would make this quite complicated). -- Added file: http://bugs.python.org/file31424/subprocess_close-default.diff Added file: http://bugs.python.org/file31425/subprocess_close-27.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18763 ___diff -r 49e23a3adf26 Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py Wed Aug 21 13:26:34 2013 +0200 +++ b/Lib/test/test_subprocess.py Thu Aug 22 21:19:52 2013 +0200 @@ -1972,6 +1972,19 @@ self.assertRaises(OSError, os.waitpid, pid, 0) self.assertNotIn(ident, [id(o) for o in subprocess._active]) +def test_close_fds_after_preexec(self): +fd_status = support.findfile(fd_status.py, subdir=subprocessdata) + +# FDs created by preexec_fn should be closed in the child +p = subprocess.Popen([sys.executable, fd_status], + stdout=subprocess.PIPE, close_fds=True, + preexec_fn=os.pipe) +output, ignored = p.communicate() + +remaining_fds = set(map(int, output.split(b','))) + +self.assertLessEqual(remaining_fds, set([0, 1, 2])) + @unittest.skipUnless(mswindows, Windows specific tests) class Win32ProcessTestCase(BaseTestCase): diff -r 49e23a3adf26 Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.cWed Aug 21 13:26:34 2013 +0200 +++ b/Modules/_posixsubprocess.cThu Aug 22 21:19:52 2013 +0200 @@ -412,17 +412,6 @@ POSIX_CALL(close(errwrite)); } -if (close_fds) { -int local_max_fd = max_fd; -#if defined(__NetBSD__) -local_max_fd = fcntl(0, F_MAXFD); -if (local_max_fd 0) -local_max_fd = max_fd; -#endif -/* TODO HP-UX could use pstat_getproc() if anyone cares about it. */ -_close_open_fd_range(3, local_max_fd, py_fds_to_keep); -} - if (cwd) POSIX_CALL(chdir(cwd)); @@ -451,6 +440,18 @@ /* Py_DECREF(result); - We're about to exec so why bother? */ } +/* close FDs after executing preexec_fn, which might open FDs */ +if (close_fds) { +int local_max_fd = max_fd; +#if defined(__NetBSD__) +local_max_fd = fcntl(0, F_MAXFD); +if (local_max_fd 0) +local_max_fd = max_fd; +#endif +/* TODO HP-UX could use pstat_getproc() if anyone cares about it. */ +_close_open_fd_range(3, local_max_fd, py_fds_to_keep); +} + /* This loop matches the Lib/os.py _execvpe()'s PATH search when */ /* given the executable_list generated by Lib/subprocess.py. */ saved_errno = 0; diff -r 84d74eb7a341 Lib/subprocess.py --- a/Lib/subprocess.py Wed Aug 21 18:25:00 2013 +0200 +++ b/Lib/subprocess.py Thu Aug 22 23:20:40 2013 +0200 @@ -1247,16 +1247,17 @@ os.close(fd) closed.add(fd) -# Close all other fds, if asked for -if close_fds: -self._close_fds(but=errpipe_write) - if cwd is not None: os.chdir(cwd) if preexec_fn: preexec_fn() +# Close all other fds, if asked for - after +# preexec_fn(), which might open FDs +if close_fds: +self._close_fds(but=errpipe_write) + if env is None: os.execvp(executable, args) else: ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16396] Importing ctypes.wintypes on Linux gives a traceback
Jason R. Coombs added the comment: The first thing it helps is that it eliminates a ValueError on import. Without it, code must catch both ValueError and ImportError to run portably: import ctypes try: import ctypes.wintypes except ImportError, ValueError: # catch ImportError and ValueError due to issue16396 pass ... def code_that_runs_only_on_win(): ctypes.wintypes.foo One _could_ cause ctypes.wintypes to always raise an ImportError on non-Windows systems, allowing the import routine to be simpler: try: import ctypes.wintypes except ImportError: pass But it would be even nicer if ctypes.wintypes always imported on any platform, such that the statement could be simply: import ctypes.wintypes But it's conceivable that certain functionality in wintypes might be useful on other systems. Consider, for example, a routine that works with pickles produced on a Windows system, or simply a comparison of some object in ctypes.wintypes against a value produced on a Windows system. The argument for that need (esp. on Python 2.7) is not strong, but since the patch to address the ValueError is simple, straightforward, and perhaps even simpler than something that would address the ValueError specifically, it seems worthwhile to accept the patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16396 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18813] Speed up slice object processing
Stefan Behnel added the comment: And in fact, callgrind shows an *increase* in the number of instructions executed for the use locals patch (898M with vs. 846M without that patch when running the fannkuch benchmark twice). That speaks against making that change, I guess. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18813 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16396] Importing ctypes.wintypes on Linux gives a traceback
Meador Inge added the comment: Using 'ctypes.wintypes' on non-Windows systems is most likely a bad idea. Most of the types are defined in terms of the types for the target that the interpreter is built for. Comparing serializations thereof in a cross platform manner doesn't make sense for a lot of cases. I really think it is only useful for Windows platforms and allowing it to silently import is misleading. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16396 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18686] Tkinter focus_get on menu results in KeyError
Serhiy Storchaka added the comment: This is a duplicate of issue734176. Thank you for your example Jeffrey. -- nosy: +serhiy.storchaka resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - Make Tkinter.py's nametowidget work with cloned menu widgets ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18686 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue734176] Make Tkinter.py's nametowidget work with cloned menu widgets
Serhiy Storchaka added the comment: issue18686 have a script which demonstrates the proposed feature. However Guilherme's patch is a little wrong. Here is updated patch. Note that even this patch is not absolute correct, because Tk adds count if new name is not unique. I.e. if .#12345 already exists it try .#123451, .#123452, .#123453, etc. It is impossible restore original name in general case. -- nosy: +serhiy.storchaka versions: +Python 2.7, Python 3.3, Python 3.4 -Python 3.2 Added file: http://bugs.python.org/file31426/nametowidget_clonedmenus_2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue734176 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
STINNER Victor added the comment: ('\udcff' + 'qwerty').encode('utf-16le', 'surrogateescape') b'\xff\xdcq\x00w\x00e\x00r\x00t\x00y\x00' Oh, this is a bug in the UTF-16 encoder: it should not encode surrogate characters = see issue #12892 I read that it's possible to set a standard stream like stdout in UTF-16 mode on Windows. I don't know if it's commonly used, nor it would impact Python. I never see a platform using UTF-16 or UTF-32 for standard streams. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18571] Implementation of the PEP 446: non-inheritable file descriptors
Changes by STINNER Victor victor.stin...@gmail.com: Added file: http://bugs.python.org/file31427/17211acb65b1.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18571 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18571] Implementation of the PEP 446: non-inheritable file descriptors
STINNER Victor added the comment: I tested 17211acb65b1.diff on my x86_64 VMs: Linux: Linux-3.9.4-200.fc18.x86_64-x86_64-with-fedora-18-Spherical_Cow = 358 tests OK. OpenIndiana: Solaris-2.11-i86pc-i386-32bit-ELF = 3 tests failed: test_locale test_tcl test_uuid -- none of these failures are related to the PEP and also occurs in default Mac OS X: Darwin-10.8.0-i386-64bit = 352 tests OK. FreeBSD: FreeBSD-9.1-RELEASE-amd64-64bit-ELF = 351 tests OK. Windows: Windows-7-6.1.7601-SP1 = 329 tests OK So it works on all (tested) platforms ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18571 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
Nick Coghlan added the comment: On 23 Aug 2013 01:40, R. David Murray rep...@bugs.python.org wrote: . (I double checked, and this does indeed work...doing the equivalent of ls temp via python preserves the bytes with that PYTHONIOENCODING setting. I don't quite understand, however, why I get the � chars if I don't redirect the output.). I assume the terminal window is doing the substitution for the improperly encoded bytes. Regarding the issue, perhaps we should convert this to a docs bug? Attempt to make the PYTHONIOENCODING=utf-8:surrogateescape easier to discover? Heck, it may be worth creating a stable URL that we can include in surrogate related error messages... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Enable surrogateescape on stdin and stdout when appropriate
Benjamin Peterson added the comment: I think it would be great to have a Unicode/bytes howto with information like this included. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18811] add ssl-based generator to random module
Christian Heimes added the comment: Improved benchmark script: Loops: 50 1 4 8 16 32 64 128 urandom (fd)0.091 0.185 0.306 0.544 1.060 1.989 3.876 urandom (fd, no buf)0.504 0.502 0.502 0.806 1.398 2.324 4.086 os.urandom()1.155 1.154 1.154 1.498 2.052 2.975 4.910 RAND_pseudo_bytes 0.436 0.436 0.435 0.555 0.753 1.064 1.664 RAND_bytes 0.412 0.417 0.417 0.534 0.741 1.046 1.708 -- Added file: http://bugs.python.org/file31428/prng.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18811 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18623] Factor out the _SuppressCoreFiles context manager
Valerie Lambert added the comment: I have included a patch that moves _SuppressCoreFiles into test.support and a test that checks whether resource.RLIMIT_CORE is being properly set and reset. It would be nice if there was a more explicit way to test the creation of core files, however. The patch also corrects a comment that stated ulimit was being set to (0, 0) when in the code only the soft limit was being set to 0. I'm pretty sure that the later should be done because then we don't run into trouble when we have to restore the hard limit to its original (higher) limit. -- keywords: +patch nosy: +lambertv Added file: http://bugs.python.org/file31429/issue-18623.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18623 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18811] add ssl-based generator to random module
Changes by Christian Heimes li...@cheimes.de: Removed file: http://bugs.python.org/file31419/prng.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18811 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16902] Add OSS module support for Solaris
Tim Mooney added the comment: For what it's worth, I've been using a patch nearly identical to this one with python 2.6.x and 2.7.x with good success, and in my case it was under Solaris 10 with the no-cost oss package from 4Front. I now have a new workstation and I've installed OpenIndiana (one of the OpenSolaris derivatives) on it, so I've had to revisit my patch slightly to get it to work with Python 2.7.5. It causes no real harm to attempt to build ossaudiodev even on earlier Solaris platforms that don't have the package installed. With Brian's patch or mine, the build reports that it expected to build ossaudiodev but that build failed. There are other modules that setup.py expects to have work on Solaris that do not, so this is not the first instance of trying something only to have it gracefully fail. It's really no different from what's being done with linux -- setup.py attempts to build ossaudiodev for all Linux distributions, even though some of them have ripped out support for OSS, in favor of ALSA or Pulse. I would agree that using individual ifdef's for each define is useful; it appears that the oss package from 4Front provides more of the defines than the modified Boomer OSS headers that are part of the OpenSolaris derivatives. My recommendation would be that Brian's patch or something like it be included as a bug fix in any releases of Python, not as just a new feature in the latest release. -- nosy: +enchanter ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16902 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18811] add ssl-based generator to random module
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18811 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18814] Add tools for cleaning surrogate escaped strings
New submission from Nick Coghlan: Prompted by issue 18713 and http://lucumr.pocoo.org/2013/7/2/the-updated-guide-to-unicode/, here are some possible utilities we could add to the codecs module to help deal with/debug issues related to surrogate escaped strings: def has_escaped_bytes(s): Returns true if string contains surrogate escaped bytes ... def replace_escaped_bytes(s): Replaces each surrogate escaped byte with a valid code point ... def decode_escaped_bytes(s, nominal_encoding, actual_encoding): Reinterprets incorrectly decoded text using a new encoding return s.encode(nominal_encoding, 'surrogateescape').decode(actual_encoding) -- messages: 195937 nosy: ncoghlan priority: normal severity: normal stage: needs patch status: open title: Add tools for cleaning surrogate escaped strings type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18814 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18713] Clearly document the use of PYTHONIOENCODING to set surrogateescape
Nick Coghlan added the comment: Note: I created issue 18814 to cover some additional tools for working with surrogate escaped strings. For this issue, we currently have http://docs.python.org/3/howto/unicode.html, which aims to be a more comprehensive guide to understanding Unicode issues. I'm thinking we may want a Debugging Unicode Errors document, which defers to the existing howto guide for those that really want to understand Unicode, and instead focuses on quick fixes for resolving various problems that may present themselves. Application developers will likely want to read the longer guide, while the debugging document would be aimed at getting script writers past their immediate hurdle, without necessarily gaining a full understanding of Unicode. The would be for this page to become the top hit for python surrogates not allowed, rather than the current top hit, which is a rejected bug report about it (http://bugs.python.org/issue13717). For example: What is the meaning of UnicodeEncodeError: surrogates not allowed? Operating system metadata on POSIX based systems like Linux and Mac OS X may include improperly encoded text values. To cope with this, Python uses the surrogateescape error handler to store those arbitrary bytes inside a Unicode object. When converted back to bytes using the same encoding and error handler, the original byte sequence is reproduced exactly. This allows operations like opening a file based on a directory listing to work correctly, even when the metadata is not properly encoded according to the system settings. The surrogates not allowed error appears when a string from one of these operating system interfaces contains an embedded arbitrary byte sequence, but an attempt is made to encode it using the default strict error handler rather than the surrogateescape handler. This commonly occurs when printing improperly encoded operating system data to the console, or writing it to a file, database or other serialised interface. The ``PYTHONIOENCODING`` environment variable can be used to ensure operating system metadata can always be read via sys.stdin and written via sys.stdout. The following command will display the encoding Python will use by default to interact with the operating system:: $ python3 -c import sys; print(sys.getfilesystemencoding()) utf-8 This can then be used to specify an appropriate setting for ``PYTHONIOENCODING``:: $ export PYTHONIOENCODING=utf-8:surrogateescape For other interfaces, there is no such general solution. If allowing the invalid byte sequence to propagate further is acceptable, then enabling the surrogateescape handler may be appropriate. Alternatively, it may be better to track these corrupted strings back to their point of origin, and either fix the underlying metadata, or else filter them out early on. If issue 18814 is implemented, then it could point to those tools. Similarly, issue 15216 could be referenced if that is implemented. -- assignee: - docs@python components: +Documentation nosy: +docs@python title: Enable surrogateescape on stdin and stdout when appropriate - Clearly document the use of PYTHONIOENCODING to set surrogateescape ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18713 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18815] DOCUMENTATION: mmap .close() doesn't close the underlying file
New submission from Jesús Cea Avión: In documentation http://docs.python.org/3.3/library/mmap.html#mmap.close you can read: Close the file. I could interpret that it is going to close the file vinculated to the MMAP. But it doesn't. It only close the MMAP object (as it should). Please, update doc to clear possible misunderstandings. Thanks. -- assignee: docs@python keywords: easy messages: 195939 nosy: docs@python, jcea priority: normal severity: normal status: open title: DOCUMENTATION: mmap .close() doesn't close the underlying file ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18815 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16396] Importing ctypes.wintypes on Linux gives a traceback
Benjamin Peterson added the comment: This is not a regression, though, so most people wouldn't be able to simplify their code because they have to support older Python versions. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16396 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18814] Add tools for cleaning surrogate escaped strings
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18814 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18816] mmap.flush() is always synchronous, hurting performance
New submission from Jesús Cea Avión: Currently, mmap.flush() does a synchronous write to the backend file. The call will wait until data is actually flushed to disk, because internally it is doing a msync(MS_SYNC). But the value of mmap.flush() is to synchronize file and memory. You don't need a synchronous write in the general case. I propose to add an optional keyword parameter with default value SYNC (compatibility) but that can be ASYNC, INVALIDATE (can be SYNC|INVALIDATE and ASYNC|INVALIDATE too). I am talking about UNIX MMAP. No idea about Windows. Check man msync for useful cases. -- components: Extension Modules keywords: easy messages: 195941 nosy: jcea priority: normal severity: normal status: open title: mmap.flush() is always synchronous, hurting performance type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18816 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18623] Factor out the _SuppressCoreFiles context manager
Charles-François Natali added the comment: Could you post your patch without the '--git' option? Apparently it doesn't work well with the code review tool. It would be nice if there was a more explicit way to test the creation of core files, however. One possibility would be to fork() a child process, and make it call os.abort(). In the parent, call os.waitpid(), and call os.WCOREDUMP() on the status. -- nosy: +neologix ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18623 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18817] Got resource warning when running Lib/aifc.py
New submission from Vajrasky Kok: The python is compiled with debug option. omittedcpython$ ./python Lib/aifc.py Lib/test/sndhdrdata/sndhdr.aiff Reading Lib/test/sndhdrdata/sndhdr.aiff nchannels = 2 nframes = 5 sampwidth = 2 framerate = 44100 comptype = b'NONE' compname = b'not compressed' sys:1: ResourceWarning: unclosed file _io.BufferedReader name='Lib/test/sndhdrdata/sndhdr.aiff' Attached the patch to close the file automatically and print Done. message not just with writing mode but for reading mode as well. -- components: Library (Lib) files: fix_resource_warning_aifc.patch keywords: patch messages: 195943 nosy: vajrasky priority: normal severity: normal status: open title: Got resource warning when running Lib/aifc.py type: resource usage versions: Python 3.4 Added file: http://bugs.python.org/file31430/fix_resource_warning_aifc.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18817 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com