[issue4701] range objects becomes hashable after attribute access
Hagen Fürstenau hfuerste...@gmx.net added the comment: I don't believe there is any driving reason for them not to be hashable. On the other hand, what is the use case for hashing objects whose equality is defined as object identity? Python 3.0 (r30:67503, Dec 4 2008, 06:47:38) [GCC 4.3.2] on linux2 Type help, copyright, credits or license for more information. range(10).__hash__ method-wrapper '__hash__' of range object at 0x7f2d61dbd210 {range(10), range(10)} {range(0, 10), range(0, 10)} I can see only confusion arising from that. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4701 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4704] Update pybench for python 3.0
New submission from Mark Dickinson dicki...@gmail.com: pybench needs to be updated for Python 3.0, in particular to remove use of cmp. Here's a patch, against the py3k branch. Questions (mainly for Marc-André Lemburg): 1. Should the version number be bumped for *all* tests, or just for those that have changed? Assuming all tests. 2. Presumably these changes should appear in 3.0.1, and should be backported to 2.x. Backport this to 2.6.2? Or just 2.7? 3. Should I update the sample output in the README file? I was going to just change the PYBENCH 2.0 line to PYBENCH 3.0, but that seems a little bit bogus without updating the rest. -- components: Demos and Tools files: pybench3.0.patch keywords: patch messages: 78090 nosy: lemburg, marketdickinson severity: normal status: open title: Update pybench for python 3.0 type: behavior versions: Python 2.7, Python 3.0, Python 3.1 Added file: http://bugs.python.org/file12405/pybench3.0.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4704 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1717] Get rid of more refercenes to __cmp__
Mark Dickinson dicki...@gmail.com added the comment: Still to do: pybench needs updating to remove a cmp reference; since the changes required for pybench are a little bit more substantial than simple cmp replacement, I've broken this out into a separate issue: issue 4704. There are many uses of cmp still in the Demos directory. How much do we care? The documentation in Doc/extending/newtypes.rst needs updating. I can have a go at this, but Georg would almost certainly do a better job. -- dependencies: +Update pybench for python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1717 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1717] Get rid of more refercenes to __cmp__
Mark Dickinson dicki...@gmail.com added the comment: Should Py_CmpToRich (in object.c) disappear? It's currently used in longobject.c, but nowhere else as far as I can tell. It shouldn't be too hard to update longobject.c to remove the use. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1717 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4016] improve linecache: reuse tokenize.detect_encoding() and io.open()
STINNER Victor victor.stin...@haypocalc.com added the comment: I also think we should consider hard adding more modules that are loaded at startup time to py3k already huge list. My patch uses tokenize modules in setup.py bootstrap. But it doesn't affect Python classic usage python or python myscript.py. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4704] Update pybench for python 3.0
Marc-Andre Lemburg m...@egenix.com added the comment: On 2008-12-20 11:54, Mark Dickinson wrote: New submission from Mark Dickinson dicki...@gmail.com: pybench needs to be updated for Python 3.0, in particular to remove use of cmp. Here's a patch, against the py3k branch. Questions (mainly for Marc-André Lemburg): 1. Should the version number be bumped for *all* tests, or just for those that have changed? Assuming all tests. Just the tests that have been updated. Since there have been a number of small changes, I think it's time to also change the pybench version itself to 2.1 (not 3.0; that's reserved for more major changes). 2. Presumably these changes should appear in 3.0.1, and should be backported to 2.x. Backport this to 2.6.2? Or just 2.7? I don't think they should go into 3.0.1 - they are a new feature and not a bug fix. I'll leave that decision to the release manager. Please backport to 2.7 only. 3. Should I update the sample output in the README file? I was going to just change the PYBENCH 2.0 line to PYBENCH 3.0, but that seems a little bit bogus without updating the rest. Please run the suite and add the complete new output. Thanks, -- Marc-Andre Lemburg eGenix.com 2008-12-02: Released mxODBC.Connect 1.0.0 http://python.egenix.com/ ::: Try our new mxODBC.Connect Python Database Interface for free ! eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4704 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1717] Get rid of more refercenes to __cmp__
Antoine Pitrou pit...@free.fr added the comment: It shouldn't be too hard to update longobject.c to remove the use. I'll do that one. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1717 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4565] io write() performance very slow
Antoine Pitrou pit...@free.fr added the comment: We can't solve this for 3.0.1, downgrading to critical. -- priority: release blocker - critical ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4565 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4561] Optimize new io library
Antoine Pitrou pit...@free.fr added the comment: We can't solve this for 3.0.1, downgrading to critical. -- priority: release blocker - critical ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4561 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4533] 3.0 file.read dreadfully slow
Antoine Pitrou pit...@free.fr added the comment: Since it is solved for 3.x and only needs to be bacported to 2.x (where the io module isn't the default), downgrading to critical. -- nosy: +pitrou priority: release blocker - critical ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4533 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3618] possible deadlock in IO library (Lib/io.py)
STINNER Victor victor.stin...@haypocalc.com added the comment: I hope that this issue will be fixed by io-c (io library rewritten in C language). ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3618 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3106] speedup some comparisons
Antoine Pitrou pit...@free.fr added the comment: I committed the patch, which will also help #1717. Thanks! -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3106 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1717] Get rid of more refercenes to __cmp__
Antoine Pitrou pit...@free.fr added the comment: It shouldn't be too hard to update longobject.c to remove the use. I'll do that one. Done in r67871, r67873. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1717 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4705] python3.0 -u: unbuffered stdout
New submission from STINNER Victor victor.stin...@haypocalc.com: I like and I need an unbuffered standard output which was provided by -u command line option (or PYTHONUNBUFFERED environment variable). Current status of -u option in Python3: the option exists and change the buffer size (disable buffering) of the stdin, stdout and stderr file descriptors. The problem is in initstdio() which creates files with buffering=-1 (default buffer) instead of buffering=0 (no buffering) or buffering=1 (line buffer). But open() enable line buffering of TextIOWrapper is buffering=-1 and the raw file is a tty. Example with py3k trunk: $ ./python import sys; sys.stdout.line_buffering True $ ./python |cat import sys; sys.stdout.line_buffering False I would like line buffering when stdout is redirected to a pipe and -u option is used. initstdio() have to be changed to choose buffering option. So it's something like: Index: Python/pythonrun.c === --- Python/pythonrun.c (révision 67870) +++ Python/pythonrun.c (copie de travail) @@ -810,7 +810,12 @@ #endif } else { - if (!(std = PyFile_FromFd(fd, stdout, w, -1, encoding, + int buffering; + if (1) + buffering = 1; /* line */ + else + buffering = -1; /* default */ + if (!(std = PyFile_FromFd(fd, stdout, w, buffering, encoding, errors, \n, 0))) { goto error; } But if (1) have to be replaced if -u option is used :-) See unbuffered variable of Modules/main.c. -- messages: 78102 nosy: haypo severity: normal status: open title: python3.0 -u: unbuffered stdout versions: Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1068268] subprocess is not EINTR-safe
STINNER Victor victor.stin...@haypocalc.com added the comment: naufraghi there are a lot of other places where EINTR naufraghi can cause and error. Can you write a list of these places? ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1068268 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4621] zipfile returns string but expects binary
STINNER Victor victor.stin...@haypocalc.com added the comment: In the ZIP file format, a filename is a byte string because we don't know the encoding. You can not guess the encoding because it's not stored in the ZIP file and it depends on the OS and the OS configuration. So t1.filename have to be a byte string and testzip.read() have to use bytes and not str. -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4621 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4621] zipfile returns string but expects binary
STINNER Victor victor.stin...@haypocalc.com added the comment: Oh, I see that zipfile.py uses the following code to choose the filename encoding: if flags 0x800: # UTF-8 file names extension filename = filename.decode('utf-8') else: # Historical ZIP filename encoding filename = filename.decode('cp437') So I'm maybe wrong: the encoding is known using a flag? ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4621 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4706] try to build a C module, but don't worry if it doesn't work
New submission from Zooko O'Whielacronx zo...@zooko.com: I was trying to install Twisted on my son's OLPC. Twisted comes with a handful of C extensions which are all optional and most of which are not expected to compile on this platform anyway (they are platform-specific for Mac or Windows). If my son's OLPC had a C compiler installed, then it would attempt to build those modules, fail, and proceed to install Twisted. However, since it doesn't have a C compiler, then instead it stops with an error. It would be nice if Twisted could tell distutils to try to build a module, and report whether the build succeeded, but don't stop the entire setup(). http://twistedmatrix.com/trac/ticket/3586 -- components: Distutils messages: 78106 nosy: zooko severity: normal status: open title: try to build a C module, but don't worry if it doesn't work ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4706 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4621] zipfile returns string but expects binary
STINNER Victor victor.stin...@haypocalc.com added the comment: Test on Ubuntu Gutsy (utf8 file system) with zip 2.32: $ mkdir x $ touch x/hé $ zip -r x.zip x adding: x/ (stored 0%) adding: x/hé (stored 0%) $ python # 3.0 trunk import zipfile testzip = zipfile.ZipFile('x.zip') testzip.infolist()[1].filename 'x/h├⌐' print(ascii(testzip.infolist()[1].filename)) 'x/h\u251c\u2310' Using my own file parse (hachoir-wx), I can see that flags=0 and filename=bytes {78 2f 68 c3 a9} (x/hé in UTF-8). You can try x.zip: I attached the file. Added file: http://bugs.python.org/file12406/x.zip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4621 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4701] range objects becomes hashable after attribute access
Nick Coghlan ncogh...@gmail.com added the comment: Hagen Fürstenau wrote: Hagen Fürstenau hfuerste...@gmx.net added the comment: I don't believe there is any driving reason for them not to be hashable. On the other hand, what is the use case for hashing objects whose equality is defined as object identity? Fast membership testing in sets to track which objects you have and haven't seen, mapping from objects to arbitrary metadata about those objects without having to explicitly redirect through id(), that kind of thing. Generally speaking, the idea is that objects should be hashable if their concept of equality cannot change over the life time of the object. Identity based equality meets that criteria, which is why objects (including range/xrange) are hashable by default. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4701 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4625] IDLE won't open anymore, .idlerc unaccessible
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: +Python 2.6 -Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4625 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4629] getopt should not accept no_argument that ends with '='
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.1.1, Python 2.1.2, Python 2.2, Python 2.2.1, Python 2.2.2, Python 2.2.3, Python 2.3, Python 2.4, Python 2.5, Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4629 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4646] distutils chokes on empty options arg in the setup function
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4646 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4670] setup.py exception when db_setup_debug = True
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: +Python 2.6 -Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4670 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4501] asyncore's urgent data management and connection closed events are broken when using poll()
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.4, Python 2.5, Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4501 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4686] Exceptions in ConfigParser don't set .args
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.1.1, Python 2.1.2, Python 2.2, Python 2.2.1, Python 2.2.2, Python 2.2.3, Python 2.3, Python 2.4, Python 2.5, Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4686 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4689] Typo in PyObjC URL on GUI Programming on the Mac
Martin v. Löwis mar...@v.loewis.de added the comment: Thanks for pointing that out. For the 2.5.3 file release, this was too late; I fixed it in the online copy only. -- nosy: +loewis resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4689 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4643] cgitb.html fails if getattr call raises exception
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4643 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4690] asyncore calls handle_write() on closed sockets when use_poll=True
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.5, Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4690 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4696] email module does not fold headers
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4696 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4228] struct.pack('L', -1)
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.5, Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4228 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3248] ScrolledText can't be placed in a PanedWindow
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3248 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3767] tkColorChooser may fail if no color is selected
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.5, Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3767 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1706039] Added clearerr() to clear EOF state
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1706039 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1040026] os.times() is bogus
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.4, Python 2.5, Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1040026 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4010] configure options don't trickle down to distutils
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4010 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2996] IDLE find in files output not formatted optimally
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.5, Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2996 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2996] IDLE find in files output not formatted optimally
Changes by Martin v. Löwis mar...@v.loewis.de: -- resolution: - works for me status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2996 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1068268] subprocess is not EINTR-safe
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.4, Python 2.5, Python 2.5.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1068268 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1717] Get rid of more refercenes to __cmp__
Marc-Andre Lemburg m...@egenix.com added the comment: Please remember to add back PyUnicode_Compare() if that hasn't already been done. Thanks, -- Marc-Andre Lemburg eGenix.com 2008-12-02: Released mxODBC.Connect 1.0.0 http://python.egenix.com/ ::: Try our new mxODBC.Connect Python Database Interface for free ! eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1717 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4621] zipfile returns string but expects binary
Eddie skr...@gmail.com added the comment: The problem is not about reading the filenames, but reading the contents of a file with filename that has non-ascii charaters. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4621 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4610] Unicode case mappings are incorrect
Alex Stapleton al...@prol.etari.at added the comment: I am trying to get a PEP together for this. Does anyone have any thoughts on how to handle comparison between unicode strings in a locale aware situation? Should __lt__ and __gt__ be specified as ignoring locale? In which case do we need to add a new method for doing locale aware comparisons? Should locale be a property of the string, an argument passed to upper/lower/isupper/islower/swapcase/capitalize/sort or global state (locale module...)? Should doing a locale aware comparison of two strings with different locales throw an exception? Should locales be represented as objects or just a string like en_GB? ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4610 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Mark Dickinson dicki...@gmail.com added the comment: Looks like a bug to me. I get the expected behaviour on my machine. Python 3.0+ (release30-maint:67878, Dec 20 2008, 17:31:44) [GCC 4.0.1 (Apple Inc. build 5490)] on darwin Type help, copyright, credits or license for more information. round(25, -1) 20.0 round(25.0, -1) 20.0 What system are you on? -- nosy: +marketdickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Changes by Giampaolo Rodola' billiej...@users.sourceforge.net: -- nosy: +giampaolo.rodola ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Mark Dickinson dicki...@gmail.com added the comment: Correction: it looks like two bugs to me. I think the wrong-return-type bug is rather serious, possibly a release blocker for 3.0.1. I'll see if I can produce a patch. The incorrect rounding (returning 30.0 instead of 20.0) is less serious, but still needs fixing. For a start, we should eliminate the use of pow() in float_round, and when the second argument to round is negative there should be a division by a power of 10 rather than a multiplication by the reciprocal of a power of 10. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4610] Unicode case mappings are incorrect
Martin v. Löwis mar...@v.loewis.de added the comment: I am trying to get a PEP together for this. Does anyone have any thoughts on how to handle comparison between unicode strings in a locale aware situation? Implementation-wise, or specification-wise? Implementation-wise, you can either try to use the C library, or ICU. For portability, ICU is better; for maintenance, the C library. Specification-wise: it should just Do The Right Thing, and probably be exposed either through the locale module, or through locale objects (in case you want to operate on multiple different locales in a single program) - see other OO languages on how they provide locales. Should __lt__ and __gt__ be specified as ignoring locale? Yes. In which case do we need to add a new method for doing locale aware comparisons? No. Collation is a feature of the locale, not of the strings. Should locale be a property of the string, an argument passed to upper/lower/isupper/islower/swapcase/capitalize/sort or global state (locale module...)? Either global state, or the object *that gets the strings passed to it*. Should doing a locale aware comparison of two strings with different locales throw an exception? Strings should not be tied into locales. Should locales be represented as objects or just a string like en_GB? If you want to have multiple of them simultaneously, you need objects. You still need to identify them by name. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4610 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Martin v. Löwis mar...@v.loewis.de added the comment: Why do you say the return type is incorrect? It should, and does, return a float. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Mark Dickinson dicki...@gmail.com added the comment: Why do you say the return type is incorrect? It should, and does, return a float. The documentation at: http://docs.python.org/dev/3.0/library/functions.html#round says, of round(x[, n]): The return value is an integer if called with one argument, otherwise of the same type as x. On the other hand, PEP 3141 (which I didn't check before) seems to say that you're right: the return value should be an instance of Real. So maybe this is just a doc bug? I have to admit that I don't understand the motivation for round(int, n) returning a float, given that the value will always be integral. It seems that this makes the two-argument version of round less useful to someone who's trying to avoid floats, perhaps working with ints and Decimals, or ints and Rationals, or just implementing fixed-point arithmetic with scaled ints. But given that a behaviour change would be backwards incompatible, and the current behaviour is supported by at least one documentation source, it seems easiest to call this a doc bug. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Mark Dickinson dicki...@gmail.com added the comment: Jeffrey, any opinion on this? -- nosy: +jyasskin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Christian Taylor di...@chello.at added the comment: I'm using Arch Linux (32 bit) with kernel 2.6.25 and glibc 2.8 on a core 2 duo. The described behaviour occurs in a precompiled binary of Python 3.0, but also in versions I've compiled just now, which includes Python 3.0+ (release30-maint:67879) As far as the rounding itself is concerned, round(x, n) seems to work as documented with n=0 on my system, while giving the same results as the Python-2.6-version of round() for n0. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Jeffrey Yasskin jyass...@gmail.com added the comment: When PEP 3141 says something should be Real, that includes both int and float as possibilities (since Real is a supertype of Integral), so it's consistent with the PEP for round(int, int) to return an int, and I agree with Mark that round(25, -1) ought to return an int. Making that change would be slightly backwards-incompatible, but IIRC, int is supposed to be usable everywhere float is, so there should be very few programs it would break. So my vote's to change it, for 3.0.1 if possible. The documentation is a little too strict on __round__ implementations by requiring round(x, y) to return the same type as x, but I think it should still encourage __round__ to return the same type. And, uh, oops for writing those bugs. Is your guess for round(25.0, -1)==30.0 that 25.0*(1/10.0) is slightly more than 2.5 on some systems? ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4610] Unicode case mappings are incorrect
Marc-Andre Lemburg m...@egenix.com added the comment: On 2008-12-20 17:19, Alex Stapleton wrote: Alex Stapleton al...@prol.etari.at added the comment: I am trying to get a PEP together for this. Does anyone have any thoughts on how to handle comparison between unicode strings in a locale aware situation? Some thoughts: * the Unicode implementation *must* stay locale independent * we should implement the Unicode collation algorithm (TR#10, http://unicode.org/reports/tr10/) * which collation to use should be a parameter of a function or object initializer and it should be possible to use multiple collations in the same application (without switching the locale) * the terms locale and collation should not be mixed; a (default) collation is a property of a locale and there can also be more than one collation per locale The Unicode collation algorithm defines collation in terms of a key function for each collation, so that already fits nicely with the key function parameter of list.sort(). Should __lt__ and __gt__ be specified as ignoring locale? In which case do we need to add a new method for doing locale aware comparisons? Unicode strings should not get any locale or collation specific methods. Instead this feature should be implemented elsewhere and the strings in question passed to this new function or object. Should locale be a property of the string, an argument passed to upper/lower/isupper/islower/swapcase/capitalize/sort or global state (locale module...)? No. See above. Should doing a locale aware comparison of two strings with different locales throw an exception? No, assigning locales to strings is not going to work and we should not go down that road. It's better to have locale aware functions for certain operations, so that you can pass your Unicode strings to these function instead of binding additional context information to the Unicode strings themselves. Should locales be represented as objects or just a string like en_GB? I think the easiest way to get the collation algorithm implemented is by using a similar scheme as for codecs: you pass a collation name to a central function and get back a collation object that implements the collation in form of a key method and a compare method. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4610 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: The code that hands-off long.__round__ to float.__round__ is a train wreck. The intended result can be computed directly and exactly for all sizes of long. -- nosy: +rhettinger priority: - critical ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Mark Dickinson dicki...@gmail.com added the comment: Is your guess for round(25.0, -1)==30.0 that 25.0*(1/10.0) is slightly more than 2.5 on some systems? Yes, something like that. I don't think it's feasible to make round perfectly correct (for floats) in all cases without implementing some amount of multiple precision code. But I think we can and should rewrite the code in such a way that it has a pretty good chance of returning correct results in common cases. Small powers of 10 can be computed exactly (up to 10**22, I think), in contrast to reciprocals of powers of 10. I'll work up a patch for round(int, int) - int, so that at least we have the option of fixing this for 3.0.1 *if* there's general agreement that that's the right way to go. Seems like a python-dev discussion might be necessary to determine that. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Martin v. Löwis mar...@v.loewis.de added the comment: When PEP 3141 says something should be Real, that includes both int and float as possibilities (since Real is a supertype of Integral), so it's consistent with the PEP for round(int, int) to return an int, and I agree with Mark that round(25, -1) ought to return an int. In that case, the doc string should be fixed: round(number[, ndigits]) - floating point number unless floating point number is supposed to include type int (which I would find fairly confusing). Wrt. this issue: PEP 3141 specified that round() rounds to even for floats, leaving it explicitly unspecified how ints get rounded. If the result is to be an int, the implementation must not go through floats. It's a problem not only in the border cases, but also for large numbers (which can't get represented correctly even remotely): py int(round(10**20+324678,-3)) 100327680 py int(round(324678,-3)) 325000 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: IMO, having long.__round__ return a float is a landmine, guaranteed to cause someone problems someday (problems that are hard to find). -- priority: critical - release blocker ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4705] python3.0 -u: unbuffered stdout
Fabio Zadrozny fab...@users.sourceforge.net added the comment: Just as a note, Pydev needs the unbuffered output (or it cannot get it). This has been brought up in the python-dev list: http://mail.python.org/pipermail/python-dev/2008-December/084436.html As a workaround for now I'm using: sys.stdout._line_buffering = True, but that doesn't seem right as it's accessing an internal attribute. -- nosy: +fabioz ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4705 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4627] Add Mac OS X Disk Images to Python.org homepage
Benjamin Peterson musiccomposit...@gmail.com added the comment: I've added installers to the website now. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4627 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4017] Tkinter cannot find Tcl/Tk on Mac OS X
Benjamin Peterson musiccomposit...@gmail.com added the comment: Ok. Thanks for testing! I've added the installers to the website. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4017 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4627] Add Mac OS X Disk Images to Python.org homepage
Martin v. Löwis mar...@v.loewis.de added the comment: I've added installers to the website now. Does that include a 3.0 installer? I can't see any. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4627 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4627] Add Mac OS X Disk Images to Python.org homepage
Benjamin Peterson musiccomposit...@gmail.com added the comment: No, I don't have one for 3.0. AFAIK, that hasn't even been attempted yet. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4627 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1040026] os.times() is bogus
Changes by Martin v. Löwis mar...@v.loewis.de: ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1040026 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Mark Dickinson dicki...@gmail.com added the comment: Here's a first attempt at a patch for round(int, int) - int. -- keywords: +patch Added file: http://bugs.python.org/file12407/round_int_int.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Martin v. Löwis mar...@v.loewis.de added the comment: Correct me if I'm wrong, but I think computing the quotient is not necessary; the remainder is sufficient: def round(n, i): if i = 0: return n i = 10**(-i) r = n%(2*i) if r i: return n-r return n-r+2*i ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Martin, that gives some answers like round(51, -2) -- 0 instead of 100. -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4707] round() shows undocumented behaviour
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Will review the patch later this evening. Thanks for the submission. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4707 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4708] os.pipe should return inheritable descriptors (Windows)
New submission from Aaron Brady castiro...@gmail.com: os.pipe should return inheritable descriptors on Windows. Patch below, test attached. New pipe() returns descriptors, which cannot be inherited. However, their permissions are set correctly, so msvcrt.get_osfhandle and msvcrt.open_osfhandle can be used to obtain an inheritable handle. Docs should contain a note to the effect. 'On Windows, use msvcrt.get_osfhandle to obtain a handle to the descriptor which can be inherited. In a subprocess, use msvcrt.open_osfhandle to obtain a new corresponding descriptor.' --- posixmodule_orig.c 2008-12-20 20:01:38.296875000 -0600 +++ posixmodule_new.c 2008-12-20 20:01:54.359375000 -0600 @@ -6481,8 +6481,12 @@ HANDLE read, write; int read_fd, write_fd; BOOL ok; + SECURITY_ATTRIBUTES sAttribs; Py_BEGIN_ALLOW_THREADS - ok = CreatePipe(read, write, NULL, 0); + sAttribs.nLength = sizeof( sAttribs ); + sAttribs.lpSecurityDescriptor = NULL; + sAttribs.bInheritHandle = TRUE; + ok = CreatePipe(read, write, sAttribs, 0); Py_END_ALLOW_THREADS if (!ok) return win32_error(CreatePipe, NULL); -- components: Library (Lib), Windows files: os_pipe_test.py messages: 78136 nosy: castironpi severity: normal status: open title: os.pipe should return inheritable descriptors (Windows) type: behavior versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1 Added file: http://bugs.python.org/file12408/os_pipe_test.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4708 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4621] zipfile returns string but expects binary
Eddie skr...@gmail.com added the comment: I read again what STINNER Victor and I think that he found another bug. Because, when listing the filenames of that zip file, the names are not displayed correctly. In fact 'x/h├⌐' == 'x/hé'.encode('utf-8').decode('cp437') So, there is again a problem with encodings when reading the contents. The problem here is that when reading one can not give the filename, because is not a key in the NameToInfo dictionary. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4621 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4621] zipfile returns string but expects binary
Eddie skr...@gmail.com added the comment: Attached is a patch that solves (I hope) the initial problem, the one from Francesco Ricciardi. -- keywords: +patch Added file: http://bugs.python.org/file12409/patch.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4621 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Senthil orsent...@gmail.com added the comment: Here is a patch to fix the issue. Jeremy, is it approach okay? Or do you have any other suggestion? -- keywords: +patch Added file: http://bugs.python.org/file12410/issue4608_py31.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4608] urllib.request.urlopen does not return an iterable object
Changes by Senthil orsent...@gmail.com: -- versions: +Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4608 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com