[issue21185] heapq fails to print in sorted order for certain inputs
New submission from wchlm: I observe the following in Python 2.6.1 in CentOS 5.9 and in Python 2.7.5 in MacOS 10.9.2. A heapified 3-element array containing elements in the order [low, high, medium] fails to print in sorted order, as shown below: import heapq lista = [1, 6, 5, 4] heapq.heapify(lista) lista # Gives sorted order, as expected [1, 4, 5, 6] listb = [1, 6, 5] heapq.heapify(listb) listb # Gives unsorted order -- unexpected and presumably a bug [1, 6, 5] [heapq.heappop(listb) for i in range(len(listb))] # But heappop works [1, 5, 6] -- components: Devguide messages: 215805 nosy: ezio.melotti, wchlm priority: normal severity: normal status: open title: heapq fails to print in sorted order for certain inputs type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21185 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21184] statistics.pvariance with known mean does not work as expected
Wolfgang Maier added the comment: I do not think this is a bug in the module, but rather incorrect usage. From your own docs: data should be an iterable of Real-valued numbers, with at least one value. The optional argument mu, if given, should be the mean of the data. If it is missing or None, the mean is automatically calculated. Nowhere does it say that mu should be the known population mean, and rightly so! The definition of p_variance is that it is the variance of the data assuming that data *is* the whole population (so the correct mean can be calculated from it) s_variance on the other hand should give an estimate of the population variance under the assumption that data is a random sample of the population, but its formula _ss/(n-1) is derived under the assumption that mu is the sample mean, not the population mean. So everything's fine and there is nothing to fix really! -- nosy: +wolma ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21184 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21185] heapq fails to print in sorted order for certain inputs
Saimadhav Heblikar added the comment: Hi, I dont think its a bug. The textbook definition of a min(or max) heap is Heaps are binary trees for which every parent node has a value less than or equal to any of its children. Therefore, when lista = [1,6,5,4], and heapify is run on it,it can be viewed as 1 / \ 4 5 6 or [1,4,5,6] When listb=[1,6,5], running heapify on it,gives 1 / \ 6 5 or [1,6,5] heapify maintains the heap-invariant - Every key is smaller than its children. This invariant is not violated in the above example. The heappop maintains the heap-invariant after popping. The line in your code [heapq.heappop(listb) for i in range(len(listb))] is the heapsort algorithm!. Hopefully, this clears your question. -- nosy: +sahutd ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21185 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21185] heapq fails to print in sorted order for certain inputs
wchlm added the comment: Hi sahutd, You may be right. I was keying off a stackoverflow example (http://stackoverflow.com/questions/12373837/heapq-module-python) that might have been misleading. In fact, the Python documentation never does say what a printed heapified array is suppose to look like -- how it unwinds the tree structure into a linear list. But from the above example I assumed it was supposed to print the sorted order, and again my assumption is quite possibly wrong. It might be useful, as a documentation issue, to say what a printed heapified array is supposed to look like. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21185 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21186] RawConfigParser __name__ option handling inconsistent
New submission from Adam Groszer: In RawConfigParser the __name__ option handling is inconsistent: RawConfigParser.options() and items() works hard to hide it, but has_options() does not -- components: Library (Lib) messages: 215809 nosy: Adam.Groszer priority: normal severity: normal status: open title: RawConfigParser __name__ option handling inconsistent versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21186 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21187] 2.7 build-installer.py with OS X 10.9
New submission from Hervé Coatanhay: With XCode 5.1 some changes were made to clang, making it impossible to build Mac OS X installer. Shipped SQLite and Sleepycat DB pass CFLAGS and LDFLAGS to compiler in their compiler check in configure script. In particular -syslibroot option is a linker option not a compiler option, and since XCode 5.1 unused command line options are considered as errors. I manage to work around this problem with the following extra CFLAGS: -Wno-error=unused-command-line-argument-hard-error-in-future I joined my modified version of build-installer.py -- assignee: ronaldoussoren components: Macintosh files: build-installer.py messages: 215810 nosy: Alzakath, ronaldoussoren priority: normal severity: normal status: open title: 2.7 build-installer.py with OS X 10.9 versions: Python 2.7 Added file: http://bugs.python.org/file34773/build-installer.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21187 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21187] 2.7 build-installer.py with OS X 10.9
Hervé Coatanhay added the comment: By the way it seems more like an SQLite / Sleepycat issue as LDFLAGS should be passed to linker not compiler. Proposed modifications are just workarounds to allow Mac installer creation on OS X 10.9. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21187 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19977] Use surrogateescape error handler for sys.stdin and sys.stdout on UNIX for the C locale
Nick Coghlan added the comment: The default locale on Fedora is indeed UTF-8 these days - the problem is that *users* are used to being able to use LANG=C to force the POSIX locale (whether for testing purposes or other reasons), and that currently means system utilities written in Python may fail in such situations if used with UTF-8 data from the filesystem (or elsewhere). (I believe there may also be other cases where POSIX mandates the use of the C locale, but Toshio would be in a better position than I am to confirm whether or not that is actually the case). So perhaps this is best left in a wait see mode for now - as the Fedora migration to Python 3 progresses, if the folks working on that find specific utilities where the Python 3.4 standard stream handling in the C locale appears problematic, then Slavek Toshio can bring them up here. The counterargument is that if we're going to change it, 3.4.1 would be a better time frame than 3.4.2. In that case, the task of identifying specific Fedora utilities of concern still falls back on Toshio Slavek, but it would be a matter of going hunting for them specifically *now*, rather than waiting until they come up over the course of the migration. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19977 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21179] Rounding half to even
Roundup Robot added the comment: New changeset 7ec8c4555772 by Mark Dickinson in branch '2.7': Issue #21179: Fix description of 'round' function for numbers.Real. http://hg.python.org/cpython/rev/7ec8c4555772 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21179 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21179] Rounding half to even
Mark Dickinson added the comment: Yep, 2.7 does round-ties-away-from-zero. There's even special code for that: the underlying machinery does a round-ties-to-even, and then there's a hack on top of that to convert to round-ties-away-from-zero. Looks like this error went unnoticed for quite a while. Now fixed. Thanks for the report! -- nosy: +mark.dickinson resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21179 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19977] Use surrogateescape error handler for sys.stdin and sys.stdout on UNIX for the C locale
STINNER Victor added the comment: The default locale on Fedora is indeed UTF-8 these days - the problem is that *users* are used to being able to use LANG=C to force the POSIX locale (whether for testing purposes or other reasons), and that currently means system utilities written in Python may fail in such situations if used with UTF-8 data from the filesystem (or elsewhere). (I believe there may also be other cases where POSIX mandates the use of the C locale, but Toshio would be in a better position than I am to confirm whether or not that is actually the case). A common situation where you get a C locale is for programs started by a crontab. If I remember correctly, these programs start with the C locale, instead of the system (user?) locale. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19977 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21176] Implement matrix multiplication operator (PEP 465)
Changes by Nathaniel Smith n...@pobox.com: -- nosy: +njs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21176 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21184] statistics.pvariance with known mean does not work as expected
Steven D'Aprano added the comment: On Wed, Apr 09, 2014 at 08:20:42AM +, Wolfgang Maier wrote: I do not think this is a bug in the module, but rather incorrect usage. [...] No, it is legitimate usage. See, for example, Numerical Recipes in Pascal by Press et al. When you know the population mean independently from the sample you're using, you should not apply Bessel's Correction (that is, you should use a denominator of n rather than n-1, which is equivalent to using the population variance). I don't think it is appropriate to include too much of the complexity about variance in the docs. (They should document the module, not teach all the odd corners of statistics theory.) I've tried to clarify the different uses of (p)variance here: http://import-that.dreamwidth.org/2291.html If you're still not convinced, this usage is equivalent to the gsl_stats_variance_with_fixed_mean function from the GNU Scientific Library: https://www.gnu.org/software/gsl/manual/html_node/Mean-and-standard-deviation-and-variance.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21184 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21186] RawConfigParser __name__ option handling inconsistent
Adam Groszer added the comment: e.g. myconfig.has_options(existing section, __name__) is always True, whereas myconfig.options(existing section) never has a __name__ entry -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21186 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21184] statistics.pvariance with known mean does not work as expected
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21184 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21188] Broken link
New submission from LtWorf: gcmodule.c lists a few reference links. http://www.arctrix.com/nas/python/gc/ http://www.python.org/pipermail/python-dev/2000-March/003869.html http://www.python.org/pipermail/python-dev/2000-March/004010.html http://www.python.org/pipermail/python-dev/2000-March/004022.html The last ones do not exist so they aren't very useful. -- components: Interpreter Core messages: 215818 nosy: tiposchi priority: normal severity: normal status: open title: Broken link type: enhancement versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21188 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21189] Broken link to patch
New submission from LtWorf: This page https://mail.python.org/mailman/listinfo/patches suggests to go here: http://www.python.org/patches/ to know how to send patches. However that page doesn't exist. -- assignee: docs@python components: Documentation messages: 215819 nosy: docs@python, tiposchi priority: normal severity: normal status: open title: Broken link to patch type: enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21184] statistics.pvariance with known mean does not work as expected
Wolfgang Maier added the comment: ok, there may be use cases for calculating a variance estimate in such situations, but IMHO what you are trying to do is to abuse a function which is not documented to be made for the purpose and then complain that it does not behave correctly. The *documented* use of the mu argument is to avoid redundant calculations of the mean of data! With just one argument, how would you know whether the user wants this documented functionality or the undocumented one ? Your suggestion of just omitting the correction means that every user who wants the documented functionality gets a potentially imprecise result. Another potential approach may be to correct the correction term based on the mean calculated from data, but such a calculation would be absurd given the documented functionality. In case the statistics module is going to use exact representations of internal results in 3.5, the error adjustment would become obsolete anyway (see http://bugs.python.org/issue20499) and pvariance could be abused just as you suggest. In this case, this usage could be sanctioned in the form of a recipe ? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21184 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21190] Broken download link on README for CPython docs
New submission from Selena Deckelmann: The page: https://github.com/python/cpython/blob/master/Doc/README.txt Links to: http://docs.python.org/download/ Which is now a 404. A URL which may be correct is: https://docs.python.org/3/download.html I'm unsure what the org policy is on linking most recent documentation, however. In the Postgres community, we have a 'current' symlink that always links to the most recent version. -- assignee: docs@python components: Documentation messages: 215821 nosy: Selena.Deckelmann, docs@python priority: normal severity: normal status: open title: Broken download link on README for CPython docs type: enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21190 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21190] Broken download link on README for CPython docs
Alex Gaynor added the comment: It looks like https://docs.python.org/3/download.html (and I suppose the 2.x variant) are the right URLs to use this. -- nosy: +alex ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21190 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21190] Broken download link on README for CPython docs
Roundup Robot added the comment: New changeset aec35c0d308b by Senthil Kumaran in branch '2.7': issue #21190: Fix the docs README link http://hg.python.org/cpython/rev/aec35c0d308b New changeset df8f49f8cdd2 by Senthil Kumaran in branch '3.4': issue #21190: Fix the broken docs download link http://hg.python.org/cpython/rev/df8f49f8cdd2 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21190 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21190] Broken download link on README for CPython docs
Senthil Kumaran added the comment: Fixed this all active versions. Thanks for the report. -- nosy: +orsenthil resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21190 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20904] HAVE_PY_SET_53BIT_PRECISION for m68k
Andreas Schwab added the comment: The only problem is that under some conditions involving denormalized numbers the result may lose a bit of precision. But that is mostly irrelevant for this issue, at least it wouldn't make it worse than it is now. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20904 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1191964] asynchronous Subprocess
Josiah Carlson added the comment: Submitting an updated patch addressing Giampaolo's comments. -- Added file: http://bugs.python.org/file34774/subprocess_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1191964 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21187] 2.7 build-installer.py with OS X 10.9
Changes by Ned Deily n...@acm.org: -- assignee: ronaldoussoren - ned.deily nosy: +ned.deily ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21187 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20904] HAVE_PY_SET_53BIT_PRECISION for m68k
Mark Dickinson added the comment: under some conditions involving denormalized numbers the result may lose a bit of precision That sounds like a non-issue for this application: the dtoa.c computations are careful to avoid subnormals in intermediate computations. If mirabilos has withdrawn his objection, is there anything blocking applying this for 3.5? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20904 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Kushal Das added the comment: Updated patch with discovering of currect locale and corresponding test case. -- Added file: http://bugs.python.org/file34775/issue21169_v3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Kushal Das added the comment: New patch with actual test case :) -- Added file: http://bugs.python.org/file34776/issue21169_v4.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21189] Broken link to patch
Georg Brandl added the comment: Barry, you run the list, so please change this to a link to bugs.python.org (and maybe docs.python.org/devguide). -- assignee: docs@python - barry nosy: +barry, georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21189 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21035] Python's HTTP server implementations hangs after 16.343 requests on MacOSX
Ronald Oussoren added the comment: This could be related to a problem described on this blog: http://savanne.be/1035-benchmarking-on-osx-http-timeouts/ As such this appears to be a platform issue and not a python one. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21035 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21191] os.fdopen() may eat file descriptor and still raise exception
New submission from Dima Tisnek: os.fdopen() should either: * consume file descriptor and return file/io object, or * leave file descriptor alone and raise an exception this invariant is broken in the following test case: fd = os.open(/, os.O_RDONLY) try: obj = os.fdopen(fd, r) except EnvironmentError: os.close(fd) # cleanup what happens: fd = os.open(/, os.O_RDONLY) -- some fd os.fdopen(fd, r) -- exception, fd refers to a directory os.close(fd) -- exception, no such fd For reference: 1. invariant is held in Python 3.3. 2. following positive test case works correctly fd = os.open(/etc/passwd, os.O_RDONLY) try: obj = os.fdopen(fd, r) # success except EnvironmentError: os.close(fd) # not reached 3. following negative test case works correctly fd = os.open(/etc/passwd, os.O_RDONLY) try: obj = os.fdopen(fd, w) # wrong mode on purpose except EnvironmentError: os.close(fd) # closed ok -- components: IO messages: 215832 nosy: Dima.Tisnek priority: normal severity: normal status: open title: os.fdopen() may eat file descriptor and still raise exception type: resource usage versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1191964] asynchronous Subprocess
Richard Oudkerk added the comment: Can you explain why you write in 512 byte chunks. Writing in one chunk should not cause a deadlock. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1191964 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21182] json.loads errors out on valid JSON
akira added the comment: You need to escape backslashes inside a Python string literal or use raw-string literals: import json json.loads(r'[[\Residential | Furniture | Cabinets\,\119.99\]]') [u'[Residential | Furniture | Cabinets,119.99]'] If the backslashes are unintentional then you could remove them: json.loads('[[Residential | Furniture | Cabinets,119.99]]') [[u'Residential | Furniture | Cabinets', u'119.99']] Note: the result is different -- nosy: +akira ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21182 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21191] os.fdopen() may eat file descriptor and still raise exception
Benjamin Peterson added the comment: I think this is just won't fix. I agree the behavior in 3.x is better, but at least fdopen() is consistent about closing in 2.x, so you could work around it by dupping the fd. -- nosy: +benjamin.peterson resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20434] Process crashes if not enough memory to import module
Andrew Svetlov added the comment: Looks like the issue has gone after 3.4 Anf it's still present for 2.7. If somebody like to make a patch for 2.7 - you are welcome! -- versions: -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20434 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21191] os.fdopen() may eat file descriptor and still raise exception
Dima Tisnek added the comment: Benjamin, I think you missed the key point: file + matching mode - fd eaten, object created file + mode mismatch - fd remains, exception raised dir + matching mode - fd eaten, exception raised The issue is about resouce (fd) management Thus, how can user code handle the error without either leaking file descriptor or possibly closing someone else's file descriptor? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21191] os.fdopen() may eat file descriptor and still raise exception
Benjamin Peterson added the comment: Ah, you're right. I misread the code. -- resolution: wont fix - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21182] json.loads errors out on valid JSON
Changes by Ned Deily n...@acm.org: -- components: +Library (Lib) -IO resolution: - invalid stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21182 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21191] os.fdopen() may eat file descriptor and still raise exception
Roundup Robot added the comment: New changeset 4a3b455abf76 by Benjamin Peterson in branch '2.7': make sure fdopen always closes the fd in error cases (closes #21191) http://hg.python.org/cpython/rev/4a3b455abf76 -- nosy: +python-dev resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21191] os.fdopen() may eat file descriptor and still raise exception
Dima Tisnek added the comment: I don't like proposed patch -- it changes semantics of more (?) common failure modes. I think it's best to keep semantics in line with Python 3.3 -- if fdopen fails, it leaves file descriptor alone. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21191] os.fdopen() may eat file descriptor and still raise exception
Benjamin Peterson added the comment: On Wed, Apr 9, 2014, at 12:48, Dima Tisnek wrote: Dima Tisnek added the comment: I don't like proposed patch -- it changes semantics of more (?) common failure modes. I don't know if opening the file with the wrong mode is any more wrong than opening a directory. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20539] math.factorial may throw OverflowError
Mark Dickinson added the comment: Updated patch. -- Added file: http://bugs.python.org/file34777/huge_factorial_input_v3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20539 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1100942] Add datetime.time.strptime and datetime.date.strptime
Maciej Szulik added the comment: Sorry it took me that long - but I'm finally attaching fixed patch. I've also checked it again current default branch and updated descriptions accordingly. -- hgrepos: +232 Added file: http://bugs.python.org/file34778/issue1100942_20140409.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1100942 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20539] math.factorial may throw OverflowError
Changes by Mark Dickinson dicki...@gmail.com: -- assignee: - mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20539 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21191] os.fdopen() may eat file descriptor and still raise exception
Dima Tisnek added the comment: Good point. Personally I think it's more pythonic to consume fd only on success. I accept that's just an opinion. In any case, let's keep error semantics in py2.7 and py3.3 same. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20434] Process crashes if not enough memory to import module
Kristján Valur Jónsson added the comment: Here we are. There were a lot of places where this was being incorrectly done. And some places where this was being considered a recoverable error, which it isn't because the source is freed. Which sort of supports my opinion that this is bad general api design, but perhaps a good conveneice function for limited use. -- Added file: http://bugs.python.org/file34779/string_resize.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20434 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21192] Idle: Print filename when running a file from editor
New submission from Terry J. Reedy: Upon restarting the user process, Idle prints a separator bar in the shell: == RESTART= When restart is due to running a file with F5, print RUN filename instead of RESTART. Idea from Adnan Umer, pydev list. For Shell / Restart Shell Cntl+F6, maybe change to RESTART Shell (my additional idea). -- messages: 215846 nosy: terry.reedy priority: normal severity: normal stage: needs patch status: open title: Idle: Print filename when running a file from editor type: enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21192 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20539] math.factorial may throw OverflowError
Josh Rosenberg added the comment: Mark, you said: OverflowError seems to have the majority vote. I'll change it to that. But your most recent patch seems to have gone back to ValueError for both cases. Is there a reason for that? FWIW, I favor OverflowError as the too large type, though I prefer the less hyperbolic phrasing of the error message in the new patch. -- nosy: +josh.rosenberg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20539 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21185] heapq fails to print in sorted order for certain inputs
Josh Rosenberg added the comment: It's not really relevant what a heapified list looks like (and there is no reason to guarantee a particular appearance, since it's an implementation detail that could change). It's supposed to function as a heap with the heap functions, that's all. The docs do give a guarantee that a sorted list is already heapified, but that's a one way guarantee: All sorted lists are heaps, but not all heaps are sorted lists. The docs also mention the big-O behavior of heapify; it's linear time, O(n), while good general purpose sorting algorithms are O(n log n). A linear algorithm cannot sort a general list. -- nosy: +josh.rosenberg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21185 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21185] heapq fails to print in sorted order for certain inputs
Josh Rosenberg added the comment: By the way, in the top answer to the Stack Overflow post you linked, it's clear that the list wasn't sorted. [44, 42, 3, 89, 10] became [3, 10, 44, 89, 42], and you'll notice, the last three elements are out of order. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21185 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11838] IDLE: make interactive code savable as a runnable script
Changes by Terry J. Reedy tjre...@udel.edu: -- type: - enhancement versions: +Python 2.7, Python 3.4, Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11838 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21185] heapq fails to print in sorted order for certain inputs
wchlm added the comment: All fair enough. I see the error of my ways. I am closing the case with a Resolution of invalid. Thanks -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21185 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21191] os.fdopen() may eat file descriptor and still raise exception
Benjamin Peterson added the comment: On Wed, Apr 9, 2014, at 13:18, Dima Tisnek wrote: Dima Tisnek added the comment: Good point. Personally I think it's more pythonic to consume fd only on success. I accept that's just an opinion. In any case, let's keep error semantics in py2.7 and py3.3 same. Unfortunately, it's not easy to implement with the 2.7 implementation of the file type. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20539] math.factorial may throw OverflowError
Mark Dickinson added the comment: Josh: well spotted; thanks for picking up on this. I was wondering whether anyone would pick up on that, and I should have mentioned the change explicitly. I do think ValueError is the correct exception here. My interpretation of OverflowError is that it represents an overflow occurring during the computation, and that's not what's happening here: we're flat-out rejecting an input value because it's out of the range of values we accept. Stefan's message influenced me a bit in that direction, too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20539 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20010] time.strftime('%z') didn't make +HHMM return in windows xp
Aaron Meurer added the comment: The docs could be much more clear about this in my opinion. -- nosy: +Aaron.Meurer ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20010 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20644] OS X installer build broken by changes to documentation build
Roundup Robot added the comment: New changeset 88572ccb8ebe by Ned Deily in branch '2.7': Issue #20644: Keep build-installer.py in sync across active versions. http://hg.python.org/cpython/rev/88572ccb8ebe New changeset e0722b5b9412 by Ned Deily in branch '3.4': Issue #20644: Keep build-installer.py in sync across active versions. http://hg.python.org/cpython/rev/e0722b5b9412 New changeset 63bd9474be49 by Ned Deily in branch 'default': Issue #20644: merge with 3.4 http://hg.python.org/cpython/rev/63bd9474be49 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20644 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21187] 2.7 build-installer.py with OS X 10.9
Roundup Robot added the comment: New changeset 63a55ed6622b by Ned Deily in branch '2.7': Issue #21187: Fix OS X installer fail-to-build with Xcode 5.1. http://hg.python.org/cpython/rev/63a55ed6622b New changeset a3299de5fc93 by Ned Deily in branch '3.4': Issue #21187: Fix OS X installer fail-to-build with Xcode 5.1. http://hg.python.org/cpython/rev/a3299de5fc93 New changeset b402e5e06f85 by Ned Deily in branch 'default': Issue #21187: merge with 3.4 http://hg.python.org/cpython/rev/b402e5e06f85 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21187 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21187] build-installer.py fails using Xcode 5.1 on OS X 10.9
Ned Deily added the comment: Thanks for the report. It should work OK now. -- components: +Build resolution: - fixed stage: - committed/rejected status: open - closed title: 2.7 build-installer.py with OS X 10.9 - build-installer.py fails using Xcode 5.1 on OS X 10.9 versions: +Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21187 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20539] math.factorial may throw OverflowError
Josh Rosenberg added the comment: I just think it's a little odd to make math.factorial uniquely sensitive to the documented definition of OverflowError. Basically every one of the non-masking PyLong_AsCType interfaces uses OverflowError for too large values. In fact, all the functions which are converting to unsigned C types and aren't doing so for program logic reasons (e.g. the shift functions don't accept a negative shift due to semantic obscurity, and long_to_bytes doesn't accept a negative length for the output) use OverflowError when a negative value is passed as well. The PyArg_ParseTuple* functions raise OverflowError as well, either implicitly (when they call a PyLong_AsCType function), or explicitly for those functions that impose more restrictive ranges than the PyLong function they wrap. Long story short: The majority of C extension functions that convert to C level types are raising OverflowError to mean out of range for implementation's chosen C type (whether too large, too small, or negative when only unsigned values excepted) as a side-effect of using Python's documented APIs. Making math.factorial the exception would be violating the reasonable expectation one might get from using similar functions. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20539 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21150] Add quick links table to argparse docs
paul j3 added the comment: While 'argparse' is complex, its organization is quite different from 'itertools'. For most purposes there is one starting point: parser = argparse.ArgumentParser(...) Nearly everything else invokes a 'parser' method. Most complex and common is 'add_argument'. Some summary tables might be useful, but 'itertools' might not be best model. -- nosy: +paul.j3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21150 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21191] os.fdopen() may eat file descriptor and still raise exception
Benjamin Peterson added the comment: I should note the C level fdopen has the the 2.x semantics. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21191 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21193] pow(a, b, c) should not raise TypeError when b is negative and c is provided
New submission from Josh Rosenberg: While checking the exceptions used to compare existing behavior while investigating #20539, I noticed a weird behavior in pow() (implemented by long_pow in longobject.c). If a 3rd argument (the modulus) is provided, and the 2nd argument (the exponent) is negative, the function raises TypeError. To my knowledge, TypeError should never be used for this purpose; some functions raise OverflowError for negative values (which violates the documented purpose of OverflowError, but the documents don't match CPython's implementation), others use ValueError (which I believe is appropriate, since it's not a matter of a C type limitation, the function is just logically restricted to the range [0,Largest possible PyLong]. I recommend switching to ValueError, possibly with a deprecation notice before making the switch if people think someone might rely on this behavior. Related: #457066 -- components: Interpreter Core messages: 215860 nosy: josh.rosenberg priority: normal severity: normal status: open title: pow(a, b, c) should not raise TypeError when b is negative and c is provided type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21193 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20539] math.factorial may throw OverflowError
Mark Dickinson added the comment: Making math.factorial the exception would be violating the reasonable expectation one might get from using similar functions. Can you point to some examples of those similar functions? I can't think of any obvious examples offhand. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20539 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21193] pow(a, b, c) should not raise TypeError when b is negative and c is provided
Changes by Ned Deily n...@acm.org: -- nosy: +mark.dickinson versions: -Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21193 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20539] math.factorial may throw OverflowError
Josh Rosenberg added the comment: A few examples (some are patently ridiculous, since the range of values anyone would use ends long before you'd overflow a 32 bit integer, let alone a 64 bit value on my build of Python, but bear with me: datetime.datetime(2**64, 1, 2) Traceback (most recent call last): File stdin, line 1, in module OverflowError: Python int too large to convert to C long datetime.datetime(-2**64, 1, 2) Traceback (most recent call last): File stdin, line 1, in module OverflowError: Python int too large to convert to C long time.mktime(time.struct_time([2**64]*9)) Traceback (most recent call last): File stdin, line 1, in module OverflowError: Python int too large to convert to C long sqlite3.enable_callback_tracebacks(2**64) Traceback (most recent call last): File stdin, line 1, in module OverflowError: Python int too large to convert to C long (That last one should really be changed to type code 'p' over 'i', or to 'B' since it's just a boolean, so overflow doesn't matter, just truthy/falsy behavior) It also happens if you pass re functions/methods a too large flags value: re.sub(r'(abc)', r'\1', 'abcd', re.IGNORECASE 64) Traceback (most recent call last): File stdin, line 1, in module File /home/shadowranger/src/cpython/Lib/re.py, line 175, in sub return _compile(pattern, flags).sub(repl, string, count) OverflowError: Python int too large to convert to C ssize_t Skipping the tracebacks, a few more examples of functions where at least one argument can raise OverflowError for implementation specific reasons, rather than a logical overflow of some kind (which is what math.factorial's is): os.getpriority, os.setpriority, os.waitid, os.tcsetpgrp, a central utility function (get_data) in zipimport (I believe the value it's parsing is derived from a zip header, so it may not be possible to feed it too-large values; haven't checked), quite a number of socket functions (often for stuff that should really be ValueErrors, e.g. port numbers out of range), and more random things. I found all of these with a simple: find cpython/ -type f -name '*.c' -exec grep -nP 'PyArg_Parse.*?\w*?[bhilL]' {} + exampleoverflow.txt There aren't any other good examples in math, largely because the other functions there deal with floats (or have arbitrary precision integer fallback paths, in the case of the log suite of functions). That find only scratches the surface; many PyArg_Parse* calls are split across lines (so my simple regex won't catch them), and old Python code has a habit of not using PyArg_Parse* even when it makes sense (presumably because they wanted to customize error messages, or didn't like the way the provided formatting codes handled edge cases). In reality, any place PyLong_As* is called (when * is not one of the masking functions) on an argument that came from the user without explicitly checking for an replacing OverflowError will potentially trigger this issue. A cursory search of locations where this function is called reveals OverflowErrors in the r parameter to to itertools.permutations, and that decimal is riddled with cases where they return if PyLong_As* has an error (including OverflowError) without changing the exception type, then a second round of range checking will set ValueError if it didn't Overflow. Examples include Context object's prec and clamp properties, but there are a dozen or more functions doing this, and I don't know if all of them are publically accessible. Fewer of the calls will be publically visible, so there's more to look through, but you can run the same search to find tons of places with potentially similar behavior: find cpython/ -type f -name '*.c' -exec grep -nP 'Py(Long|Number)_As(?!.*(?:Mask|NULL|PyExc_(?!Overflow)))' {} + exampleoverflowdirectcall.txt I suspect that for every case where Python standard libs behave this way (raising OverflowErrors in ways that disregard the official docs description of when it should be used), there are a dozen where a third party module behaves this way, since third party modules are more likely to use the standardized argument parsing and numeric parsing APIs without rejiggering the default exceptions, assuming that the common APIs raise the correct errors. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20539 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21176] Implement matrix multiplication operator (PEP 465)
Benjamin Peterson added the comment: I think this patch is fairly straightforward, and I don't want it to rot, so here we go... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21176 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21176] Implement matrix multiplication operator (PEP 465)
Roundup Robot added the comment: New changeset c553d8f72d65 by Benjamin Peterson in branch 'default': PEP 465: a dedicated infix operator for matrix multiplication (closes #21176) http://hg.python.org/cpython/rev/c553d8f72d65 -- nosy: +python-dev resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21176 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21193] pow(a, b, c) should not raise TypeError when b is negative and c is provided
Josh Rosenberg added the comment: Here's the trivial patch for code and the associated unit test (we were actually testing that it raised TypeError specifically; it now raises ValueError, and the unit test expects ValueError). unit tests passed aside from test_io, but I'm pretty sure that's unrelated; my Linux VM freezes up once in a while, which does nasty things to timing dependent I/O tests. -- keywords: +patch Added file: http://bugs.python.org/file34780/pow_typeerror_to_valueerror.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21193 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21193] pow(a, b, c) should not raise TypeError when b is negative and c is provided
Josh Rosenberg added the comment: As I mentioned on another bug, I filled out and submitted the contributor agreement form electronically earlier this week, it just hasn't propagated yet. I'm fairly sure trained monkeys reading the description of this bug report would produce the exact same patch (s/TypeError/ValueError/ on one line in each of two files) though, so I'll trust you if you say you reimplemented it rather than take the legal risk. :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21193 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21192] Idle: Print filename when running a file from editor
Changes by Adnan Umer adnanume...@gmail.com: -- components: +IDLE ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21192 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com