[issue1109] Warning required when calling register() on an ABCMeta subclass
New submission from Mark Summerfield: GvR asked me to add this to the bug tracker. If you do this: class A(ABCMeta): pass A.register(list) you get this error message: Traceback (most recent call last): File "", line 1, in RuntimeError: maximum recursion depth exceeded in __instancecheck__ This is not very helpful. You probably meant to write: class A(metaclass=ABCMeta): pass Perhaps a warning message like this would be better: "register() should not be called on an ABCMeta subclass; maybe you forgot the metaclass keyword argument when declaring the class?" -- components: Interpreter Core messages: 55663 nosy: mark severity: normal status: open title: Warning required when calling register() on an ABCMeta subclass type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1109> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9522] xml.etree.ElementTree forgets the encoding
Mark Summerfield added the comment: Perhaps a useful compromise would be to add an "encoding" attribute that is set to the encoding of the XML file that's read in (and with a default of "ascii"). That way it would be possible to preserve the encoding, e.g.: import xml.etree.ElementTree as etree xml_tree = etree.ElementTree(in_filehandle) # process the tree xml_tree.write(out_filehandle, encoding=xml_tree.encoding) -- ___ Python tracker <http://bugs.python.org/issue9522> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9522] xml.etree.ElementTree forgets the encoding
Mark Summerfield added the comment: I don't see how lxml is relevant here? lxml is a third party library, whereas etree is part of the standard library. And according to the 3.1.2 docs etree doesn't have a docinfo (or any other) property. -- ___ Python tracker <http://bugs.python.org/issue9522> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10926] Some Invalid Relative Imports succeed in Py 3.0 & 3.1 [& correctly fail in 3.2rc1]
New submission from Mark Summerfield : I'm reporting this at Georg Brandl's suggestion. If you unpack the attached (tiny) tarball you get this directory structure: Graphics/ Graphics/Xpm.py Graphics/Vector/ Graphics/Vector/__init__.py Graphics/Vector/Svg.py Graphics/__init__.py The Svg.py file has this content: #!/usr/bin/env python3 from ..Graphics import Xpm SVG = 1 Here are 3 interactive actions, one each for 3.0, 3.1, and 3.2rc1: $ python30 Python 3.0.1 (r301:69556, Jul 15 2010, 10:31:51) [GCC 4.4.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from Graphics.Vector import * >>> Svg.SVG 1 $ python31 Python 3.1.2 (r312:79147, Jul 15 2010, 10:56:05) [GCC 4.4.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from Graphics.Vector import * >>> Svg.SVG 1 $ ~/opt/python32rc1/bin/python3 Python 3.2rc1 (r32rc1:88035, Jan 16 2011, 08:32:59) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from Graphics.Vector import * Traceback (most recent call last): File "", line 1, in File "Graphics/Vector/Svg.py", line 2, in from ..Graphics import Xpm ImportError: No module named Graphics So clearly 3.0 and 3.1 have the same behavior as each other; and this is different from 3.2rc1, and Georg says that 3.0 and 3.1 have a bug and that 3.2rc1 is correct. PS R. David Murray suggests that this might be related to http://bugs.python.org/issue7902 -- components: Interpreter Core files: py-import-bug.tar.gz messages: 126399 nosy: mark priority: normal severity: normal status: open title: Some Invalid Relative Imports succeed in Py 3.0 & 3.1 [& correctly fail in 3.2rc1] type: behavior versions: Python 3.1, Python 3.2 Added file: http://bugs.python.org/file20424/py-import-bug.tar.gz ___ Python tracker <http://bugs.python.org/issue10926> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10926] Some Invalid Relative Imports succeed in Py 3.0 & 3.1 [& correctly fail in 3.2rc1]
Mark Summerfield added the comment: I just installed 3.1.3 and it does indeed give the import error: Python 3.1.3 (r313:86834, Jan 17 2011, 16:29:46) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from Graphics.Vector import * Traceback (most recent call last): File "", line 1, in File "Graphics/Vector/Svg.py", line 2, in from ..Graphics import Xpm ImportError: No module named Graphics -- ___ Python tracker <http://bugs.python.org/issue10926> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2851] Eliminate Perl legacy in re flag names
New submission from Mark Summerfield <[EMAIL PROTECTED]>: The re module has the following flags (amongst others): re.X == re.VERBOSE re.S == re.DOTALL The short forms of both these flags are clearly taken from Perl, but they don't seem necessary for Python and are confusing since all the other short names start with the same letter as the long name, e.g., re.I == re.IGNORECASE and re.M == re.MULTILINE. Why not add re.V for re.VERBOSE and re.D for re.DOTALL and kill re.X and re.S and say a final farewell to Perl? -- components: Library (Lib) messages: 66817 nosy: mark severity: normal status: open title: Eliminate Perl legacy in re flag names type: feature request versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2851> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2806] Py30a5: Tk Menu Alt-f behaves differently Linux vs Windows
Mark Summerfield <[EMAIL PROTECTED]> added the comment: This bug can be worked around by using the more modern style of menu creation. If the program that exhibits the bug has its __init__() replaced as follows it works correctly on both Linux and Windows: def __init__(self, parent): self.parent = parent menu = Menu(self.parent) self.parent.config(menu=menu) fileMenu = Menu(menu) for label, command in ( ("New...", self.fileNew), ("Open...", self.fileOpen), ("Quit", self.fileQuit)): fileMenu.add_command(label=label, command=command) menu.add_cascade(label="File", menu=fileMenu, underline=0) __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2806> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2913] idlelib/EditorWindow.py uses xrange()
New submission from Mark Summerfield <[EMAIL PROTECTED]>: In Py30a5 idlelib/EditorWindow.py line 292 uses xrange() when it should use range(). -- components: IDLE messages: 67060 nosy: mark severity: normal status: open title: idlelib/EditorWindow.py uses xrange() versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2913> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2636] Regexp 2.6 (modifications to current re 2.2.2)
Mark Summerfield <[EMAIL PROTECTED]> added the comment: AFAIK if you have a regex with named capture groups there is no direct way to relate them to the capture group numbers. You could do (untested; Python 3 syntax): d = {v: k for k, v in match.groupdict()} for i in range(match.lastindex): print(i, match.group(i), d[match.group(i)]) One possible solution would be a grouptuples() function that returned a tuple of 3-tuples (index, name, captured_text) with the name being None for unnamed groups. Anyway, good luck with all your improvements, I will be especially glad if you manage to do (2) and (8) (and maybe (3)). -- nosy: +mark ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2636> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2999] Py30a5: str.replace() tiny doc error
New submission from Mark Summerfield <[EMAIL PROTECTED]>: >>> help(str.replace) Help on method_descriptor: replace(...) S.replace (old, new[, maxsplit]) -> unicode Return a copy of S with all occurrences of substring old replaced by new. If the optional argument maxsplit is given, only the first maxsplit occurrences are replaced. The variable name maxsplit should be "maxreplacements" or similar. Also "-> unicode" should be "-> str" -- assignee: georg.brandl components: Documentation messages: 67491 nosy: georg.brandl, mark severity: normal status: open title: Py30a5: str.replace() tiny doc error versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2999> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3000] 2to3 doesn't handle print(whatever); print nor string.* functions
New submission from Mark Summerfield <[EMAIL PROTECTED]>: Py30a5 2to3 currently does not cope correctly with this: print whatever; print which it converts to: print(whatever); print This is a subtle error since "print" on its own is valid. Nor does it replace the deprecated string functions, string.capitalize(), string.count(), string.join(), string.lower(), string.replace(), string.split(), and string.strip(). -- assignee: collinwinter components: 2to3 (2.x to 3.0 conversion tool) messages: 67493 nosy: collinwinter, mark severity: normal status: open title: 2to3 doesn't handle print(whatever); print nor string.* functions versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3000> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2636] Regexp 2.6 (modifications to current re 2.2.2)
Mark Summerfield <[EMAIL PROTECTED]> added the comment: [snip] > 13) Implement a grouptuples(...) method as per Mark Summerfield's > suggest on 2008-05-28 09:38. grouptuples would take the same filtering > parameters as the other group* functions, and would return a list of 3- > tuples (unless only 1 group was requested). It should default to all > match groups (1..n, not group 0, the matching string). :-) [snip] > Finally, I would like suggestions on how to handle name collisions when > match group names are provided as attributes. For instance, an > expression like '(?P.*)' would match more or less any string and > assign it to the name "pos". But "pos" is already an attribute of the > Match object, and therefore pos cannot be exposed as a named match group > attribute, since match.pos will return the usual meaning of pos for a > match object, not the value of the capture group names "pos". > > I have 3 proposals as to how to handle this: > > a) Simply disallow the exposure of match group name attributes if the > names collide with an existing member of the basic Match Object > interface. I don't like the prefix ideas and now that you've spelt it out I don't like the sometimes m.foo will work and sometimes it won't. So I prefer m['foo'] to be the canonical way because that guarantees your code is always consistent. BTW I wanted to do a simple regex to match a string that might or might not be quoted, and that could contain quotes (but not those used to delimit it). My first attempt was illegal: (?P['"])?([^(?=quote)])+(?(quote)(?=quote)) It isn't hard to work round but it did highlight the fact that you can't use captures inside character classes. I don't know if Perl allows this; I guess if it doesn't then Python shouldn't either since GvR wants the engine to be Perl compatible. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2636> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3140] str.format("{0:n}") poss. bug with setlocale()
New submission from Mark Summerfield <[EMAIL PROTECTED]>: Python 30b1 >>> import locale >>> locale.setlocale(locale.LC_ALL, "en_US.UTF-8") 'en_US.UTF-8' >>> for x in (1234,12345,123456,1234567,12345678,123456789,1234567890,12345678900): print("[{0:>20n}]".format(x)) [1,234] [ 12,345] [ 123,456] [ 1,234,567] [12,345,678] [ 123,456,789] [ 1,234,567,890] [ 12,345,678,900] I expected that the commas would not increase the width, but maybe this was the intended behaviour? -- messages: 68403 nosy: mark severity: normal status: open title: str.format("{0:n}") poss. bug with setlocale() type: behavior versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3140> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3141] Linux build requires Mac module _gestalt
New submission from Mark Summerfield <[EMAIL PROTECTED]>: When you build 30b1 on Linux (I tried Fedora 8 and Xubuntu 8) you get a message that make failed to find the bits to build "_gestalt", which I think is a Mac-thing not a Linux thing. Anyway, Barry asked me to add this as a bug. -- components: Build messages: 68405 nosy: mark severity: normal status: open title: Linux build requires Mac module _gestalt versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3141> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3142] urllib docs don't match the new modules
New submission from Mark Summerfield <[EMAIL PROTECTED]>: Py30b1 The module renaming of urllib's modules (and the getting rid of urllib2) has been done---but this isn't reflected in the docs. -- assignee: georg.brandl components: Documentation messages: 68406 nosy: georg.brandl, mark severity: normal status: open title: urllib docs don't match the new modules versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3142> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2636] Regexp 2.6 (modifications to current re 2.2.2)
Mark Summerfield <[EMAIL PROTECTED]> added the comment: [snip] It seems to me that both using a special prefix or adding an option are adding a lot of baggage and will increase the learning curve. The nice thing about (3) (even without slicing) is that it seems a v. natural extension. But (2) seems magical (i.e., Perl-like rather than Pythonic) which I really don't like. BTW I just noticed this: '<_sre.SRE_Pattern object at 0x9ded020>' >>> "{0!r}".format(rx) '<_sre.SRE_Pattern object at 0x9ded020>' >>> "{0!s}".format(rx) '<_sre.SRE_Pattern object at 0x9ded020>' >>> "{0!a}".format(rx) That's fair enough, but maybe for !s the output should be rx.pattern? ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2636> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3175] multiprocessing build fails on Fedora 8 and Xubuntu 8 + solution
New submission from Mark Summerfield <[EMAIL PROTECTED]>: I built Python 30b1 from the tarball on Fedora 8 and Xubuntu 8. My only configure switch was --prefix to get a local build. On both systems the only build error I got was: Failed to find the necessary bits to build these modules: _gestalt which shouldn't matter because it is a Mac thing not a Linux thing (and already reported)---there were no other error messages, so no warning that multiprocessing wasn't working. Running make test does _not_ indicate any problem with the multiprocessing module (same output on both systems): 302 tests OK. 21 tests skipped: test_bsddb3 test_cProfile test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_curses test_kqueue test_normalization test_ossaudiodev test_pep277 test_socketserver test_startfile test_timeout test_urllib2net test_urllibnet test_winreg test_winsound test_xmlrpc_net test_zipfile64 Those skips are all expected on linux2. If I run test_multiprocessing.py manually from the _build_ directory it works fine. But if I use the locally installed Python 3 (soft linked to python3 in my PATH), on both systems I get this: : python3 -V Python 3.0b1 : python3 Lib/test/test_multiprocessing.py Traceback (most recent call last): File "Lib/test/test_multiprocessing.py", line 19, in import multiprocessing.dummy ImportError: No module named multiprocessing.dummy Now given that the tests all pass it seemed to me that the problem was with the build rather than with the module itself, and that led to the solution, which for both systems is the same simple command: cp -R ~/download/Python-3.0b1/Lib/multiprocessing ~/opt/python30b1/lib/python3.0 So it seems that although the shared library is copied correctly from the build directory, what has been forgotten is to copy the multiprocessing directory itself. -- components: Build messages: 68618 nosy: mark severity: normal status: open title: multiprocessing build fails on Fedora 8 and Xubuntu 8 + solution versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3175> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3198] strings don't seem to roundtrip with repr()
New submission from Mark Summerfield <[EMAIL PROTECTED]>: With 2.5.2 and 30b1 strings don't round trip like numbers do. I guess it has been like this a long time so isn't a bug, but it does seem inconsistent. Both 2.5.2 and 30b1: >>> x = 5 >>> x == int(repr(x)) True >>> x = "Test Text" >>> x == str(repr(x)) False The reason is that an extra set of enclosing quotes are added. -- components: Interpreter Core messages: 68728 nosy: mark severity: normal status: open title: strings don't seem to roundtrip with repr() type: behavior versions: Python 2.5, Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3198> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3252] str.tobytes() and bytes/bytearray.tostr()
New submission from Mark Summerfield <[EMAIL PROTECTED]>: I know it is almost certainly too late, but I think a lot of people will be confused by str.decode() and bytes.encode() (or was that the other way around)? Calling the methods str.tobytes() and bytes.tostr() (or nicer, str.to_bytes() and bytes.to_str()) would be hard to confuse and IMO will lead to fewer bug reports and complaints once Python 3.0 final comes out. And there is a kind of precedent in that threading.isDaemon() became threading.is_daemon() between 30a5 and 30b1. -- components: Interpreter Core messages: 69047 nosy: mark severity: normal status: open title: str.tobytes() and bytes/bytearray.tostr() type: feature request versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3252> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3000] 2to3 doesn't handle print(whatever); print nor string.* functions
Changes by Mark Summerfield <[EMAIL PROTECTED]>: -- type: -> behavior ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3000> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2834] re.IGNORECASE not Unicode-ready
Changes by Mark Summerfield <[EMAIL PROTECTED]>: -- nosy: +mark ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2834> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3394] zipfile.writestr doesn't set external attributes, so files are extracted mode 000 on Unix
Changes by Mark Summerfield <[EMAIL PROTECTED]>: -- nosy: +mark ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3394> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3598] multiprocessing.Pool windows/linux behaviour difference
New submission from Mark Summerfield <[EMAIL PROTECTED]>: When the attached program is run on Linux it runs "instantly" and outputs one line, e.g.: $ python3 mtest.py 100 files, 1702627142 bytes (The number of bytes will vary depending on the system.) When run on Windows XP there is no output at all; many processes seem to be created but nothing seems to actually get done. In both cases I'm using Py30b2. -- components: Library (Lib) files: mtest.py messages: 71408 nosy: mark severity: normal status: open title: multiprocessing.Pool windows/linux behaviour difference versions: Python 3.0 Added file: http://bugs.python.org/file11154/mtest.py ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3598> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3598] multiprocessing.Pool windows/linux behaviour difference
Mark Summerfield <[EMAIL PROTECTED]> added the comment: On 2008-08-19, Antoine Pitrou wrote: > Antoine Pitrou <[EMAIL PROTECTED]> added the comment: > > For what it's worth, this is documented in > http://docs.python.org/dev/library/multiprocessing.html#windows Ah yes, sorry I missed that. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3598> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2834] re.IGNORECASE not Unicode-ready
Mark Summerfield <[EMAIL PROTECTED]> added the comment: On 2008-08-19, Antoine Pitrou wrote: > Antoine Pitrou <[EMAIL PROTECTED]> added the comment: > > Fixed in r65860. Someone should check the docs though (at least try to > generate them, and review my changes a bit since English isn't my mother > tongue). I've revised the ASCII and LOCALE-related texts in re.rst in r65903. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2834> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2834] re.IGNORECASE not Unicode-ready
Mark Summerfield <[EMAIL PROTECTED]> added the comment: On 2008-08-19, Antoine Pitrou wrote: > Antoine Pitrou <[EMAIL PROTECTED]> added the comment: > > Fixed in r65860. Someone should check the docs though (at least try to > generate them, and review my changes a bit since English isn't my mother > tongue). And two more (tiny) fixes in r65904; that's my lot:-) ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2834> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3628] IDLE does not run with Py30b3
New submission from Mark Summerfield <[EMAIL PROTECTED]>: When I try to run IDLE in Py30b3 I get a traceback, then the main window appears with an error message box and an OK button; once I click OK, IDLE goes away. $ ~/opt/python30b3/bin/idle Traceback (most recent call last): File "", line 1, in File "/home/mark/opt/python30b3/lib/python3.0/idlelib/run.py", line 76, in main sockthread.set_daemon(True) AttributeError: 'Thread' object has no attribute 'set_daemon' It looks like there's been some mixup with threading... in an earlier beta there was setDaemon(), then it became set_daemon(), and now it is back to setDaemon() again. And unfortunately, the obvious fix (change the name to setDaemon()), although it gets past this problem, just leads to another: $ ~/opt/python30b3/bin/idle # using setDaemon Traceback (most recent call last): File "", line 1, in File "/home/mark/opt/python30b3/lib/python3.0/idlelib/run.py", line 76, in main sockthread.setDaemon(True) File "/home/mark/opt/python30b3/lib/python3.0/threading.py", line 674, in setDaemon "Thread.daemon property", DeprecationWarning) File "/home/mark/opt/python30b3/lib/python3.0/warnings.py", line 18, in showwarning file.write(formatwarning(message, category, filename, lineno, line)) TypeError: idle_formatwarning_subproc() takes exactly 4 positional arguments (5 given) I did run make test and got 300 tests OK with 22 skipped all expected on linux2. -- components: IDLE messages: 71611 nosy: mark severity: normal status: open title: IDLE does not run with Py30b3 type: crash versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3628> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3629] Py30b3 won't compile a regex that compiles with 2.5.2 and 30b2
New submission from Mark Summerfield <[EMAIL PROTECTED]>: Here are the results of running the same tiny program against 2.5.2, 30b2, and 30b3. The program creates a regex and tries to match 3 strings. For 2.5.2 and 30b2 this works fine; for 30b3 the regex won't even compile: $ python -V Python 2.5.2 $ python /tmp/retext.py name="name1" value="value1" name="name2" value="value #2" name="name3" value="value '3'" $ $ ~/opt/python30b2/bin/python3.0 -V Python 3.0b2 $ ~/opt/python30b2/bin/python3.0 /tmp/retext.py name="name1" value="value1" name="name2" value="value #2" name="name3" value="value '3'" $ $ ~/opt/python30b3/bin/python3.0 /tmp/retext.py Traceback (most recent call last): File "/tmp/retext.py", line 8, in """, re.VERBOSE) File "/home/mark/opt/python30b3/lib/python3.0/re.py", line 203, in compile return _compile(pattern, flags) File "/home/mark/opt/python30b3/lib/python3.0/re.py", line 255, in _compile p = sre_compile.compile(pattern, flags) File "/home/mark/opt/python30b3/lib/python3.0/sre_compile.py", line 520, in compile groupindex, indexgroup RuntimeError: invalid SRE code -- components: Regular Expressions files: retext.py messages: 71614 nosy: mark severity: normal status: open title: Py30b3 won't compile a regex that compiles with 2.5.2 and 30b2 type: behavior versions: Python 3.0 Added file: http://bugs.python.org/file11185/retext.py ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3629> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3628] IDLE does not run with Py30b3
Mark Summerfield <[EMAIL PROTECTED]> added the comment: Just realised how to fix this. Change line 76 in idlelib/run.py: # change this: sockthread.set_daemon(True) # to this: sockthread.daemon = True and IDLE runs fine. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3628> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3930] urllib.request.urlopen() different on Windows than Linux
New submission from Mark Summerfield <[EMAIL PROTECTED]>: Py30rc1 On Windows the file object returned by urllib.request.urlopen() appears to be in binary mode, so .read() returns a bytes object. But on Linux it appears to be in text mode, so .read() returns a str object. It seeems to me that the same type of file object should be returned on all platforms, otherwise you have to test the platform and use str.encode() or bytes.decode() depending on where the code is running. -- components: Library (Lib) messages: 73565 nosy: mark severity: normal status: open title: urllib.request.urlopen() different on Windows than Linux type: behavior versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3930> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3930] urllib.request.urlopen() different on Windows than Linux
Mark Summerfield <[EMAIL PROTECTED]> added the comment: Sorry, I now can't reproduce it. I made a tiny test script and it worked fine on both Windows and Linux. Now when I run the real test that works fine too. So could you close/remove this "bug" for me please? #!/usr/bin/env python3 import sys import urllib.request print(sys.version) fh = urllib.request.urlopen("http://www.python.org/index.html";) data = fh.read() fh.close() print(type(data)) # output when run on Linux: 3.0rc1 (r30rc1:66499, Sep 18 2008, 17:45:22) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] # output when run on Windows: 3.0rc1 (r30rc1:66507, Sep 18 2008, 14:47:08) [MSC v.1500 32 bit (Intel)] ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3930> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3955] maybe doctest doesn't understand unicode_literals?
New submission from Mark Summerfield <[EMAIL PROTECTED]>: # This program works fine with Python 2.5 and 2.6: def f(): """ >>> f() 'xyz' """ return "xyz" if __name__ == "__main__": import doctest doctest.testmod() But if you put the statement "from __future__ import unicode_literals" at the start then it fails: File "/tmp/test.py", line 5, in __main__.f Failed example: f() Expected: 'xyz' Got: u'xyz' I don't know if it is a bug or a feature but I didn't see any mention of it in the bugs or docs so thought I'd mention it. -- components: Library (Lib) messages: 73710 nosy: mark severity: normal status: open title: maybe doctest doesn't understand unicode_literals? type: behavior versions: Python 2.6 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3955> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8557] subprocess portability issue
Mark Summerfield added the comment: IMO there's another problem with subprocess portablity---the lack of control over encodings: see issue 6135. -- nosy: +mark ___ Python tracker <http://bugs.python.org/issue8557> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1109] Warning required when calling register() on an ABCMeta subclass
Mark Summerfield added the comment: On 2007-11-30, Christian Heimes wrote: > Christian Heimes added the comment: > > Fixed in r59233. Please adjust the error message if you don't like it. > > TypeError: register() cannot be called on an ABCMeta subclass, use class > Example(metaclass=abc.ABCMeta) instead. I think it is fine---but seems that GvR doesn't want it! __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1109> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1585] IDLE uses non-existent xrange() function (Py30a2)
New submission from Mark Summerfield: When I start IDLE I get this: Python 3.0a2 (r30a2:59382, Dec 10 2007, 14:21:37) [GCC 4.1.2 20070626 (Red Hat 4.1.2-13)] on linux2 Type "copyright", "credits" or "license()" for more information. Personal firewall software may warn about the connection IDLE makes to its subprocess using this computer's internal loopback interface. This connection is not visible on any external interface and no data is sent to or received from the Internet. IDLE 3.0a1 >>> That's fine (if slightly confusing regarding the version numbers), but if I click Options->Configure I get this error output: : Exception in Tkinter callback Traceback (most recent call last): File "/home/mark/opt/python30a2/lib/python3.0/lib-tk/Tkinter.py", line 1402, in __call__ return self.func(*args) File "/home/mark/opt/python30a2/lib/python3.0/idlelib/EditorWindow.py", line 385, in config_dialog configDialog.ConfigDialog(self.top,'Settings') File "/home/mark/opt/python30a2/lib/python3.0/idlelib/configDialog.py", line 50, in __init__ self.CreateWidgets() File "/home/mark/opt/python30a2/lib/python3.0/idlelib/configDialog.py", line 69, in CreateWidgets page_names=['Fonts/Tabs','Highlighting','Keys','General']) File "/home/mark/opt/python30a2/lib/python3.0/idlelib/tabbedpages.py", line 398, in __init__ self.add_page(name) File "/home/mark/opt/python30a2/lib/python3.0/idlelib/tabbedpages.py", line 413, in add_page self._tab_set.add_tab(page_name) File "/home/mark/opt/python30a2/lib/python3.0/idlelib/tabbedpages.py", line 76, in add_tab self._arrange_tabs() File "/home/mark/opt/python30a2/lib/python3.0/idlelib/tabbedpages.py", line 163, in _arrange_tabs for row_index in xrange(n_rows): NameError: global name 'xrange' is not defined I tried changing xrange to range, but that doesn't work: : Exception in Tkinter callback Traceback (most recent call last): File "/home/mark/opt/python30a2/lib/python3.0/lib-tk/Tkinter.py", line 1402, in __call__ return self.func(*args) File "/home/mark/opt/python30a2/lib/python3.0/idlelib/EditorWindow.py", line 385, in config_dialog configDialog.ConfigDialog(self.top,'Settings') File "/home/mark/opt/python30a2/lib/python3.0/idlelib/configDialog.py", line 50, in __init__ self.CreateWidgets() File "/home/mark/opt/python30a2/lib/python3.0/idlelib/configDialog.py", line 69, in CreateWidgets page_names=['Fonts/Tabs','Highlighting','Keys','General']) File "/home/mark/opt/python30a2/lib/python3.0/idlelib/tabbedpages.py", line 398, in __init__ self.add_page(name) File "/home/mark/opt/python30a2/lib/python3.0/idlelib/tabbedpages.py", line 413, in add_page self._tab_set.add_tab(page_name) File "/home/mark/opt/python30a2/lib/python3.0/idlelib/tabbedpages.py", line 76, in add_tab self._arrange_tabs() File "/home/mark/opt/python30a2/lib/python3.0/idlelib/tabbedpages.py", line 148, in _arrange_tabs for tab_name in self._tabs.keys(): RuntimeError: dictionary changed size during iteration -- components: IDLE messages: 58417 nosy: mark severity: normal status: open title: IDLE uses non-existent xrange() function (Py30a2) type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1585> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1585] IDLE uses non-existent xrange() function (Py30a2)
Mark Summerfield added the comment: Amaury Forgeot d'Arc says he's fixed this in change 59456 (but I don't know how---or if---I can change its status). __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1585> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1586] IDLE no longer shows colour syntax highlighting in the Shell (Py30a2)
New submission from Mark Summerfield: When I do: import sys; dir(sys) everything is shown in plain black & white, but in the IDLE that came with Py30a1 color syntax highlighting is used. -- components: IDLE messages: 58423 nosy: mark severity: minor status: open title: IDLE no longer shows colour syntax highlighting in the Shell (Py30a2) type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1586> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1588] str.format() wrongly formats complex() numbers (Py30a2)
New submission from Mark Summerfield: >>> x = complex(1, 2/3) >>> "{0} {0:.5}".format(x) '(1+0.6667j) (1+0.' The complex number is being formatted as if it were a string and simply truncated to 5 characters. I would expect each part of the complex number to be formatted according to the format specifier, i.e., in the case of :.5 to both have 5 digits after the decimal point. -- components: Interpreter Core messages: 58428 nosy: mark severity: normal status: open title: str.format() wrongly formats complex() numbers (Py30a2) type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1588> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1588] str.format() wrongly formats complex() numbers (Py30a2)
Mark Summerfield added the comment: On 2007-12-11, Guido van Rossum wrote: > Guido van Rossum added the comment: > > This really is a feature request -- in Python 2.x there is no formatting > code for complex numbers at all, and "%.5s" % complex(...) does the same > thing. I thought Python 3 was meant to be an _improvement_:-) > I agree it would be neat to have control over complex numbers using the > same formatting language used for floats; but I note that it's easy > enough to do this manually, e.g. > > >>> "{0.real:.5}+{0.imag:.5}j".format(z) > > '1+0.7j' Good point, I'll use that. Thanks! __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1588> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1588] str.format() wrongly formats complex() numbers (Py30a2)
Mark Summerfield added the comment: On 2007-12-11, Guido van Rossum wrote: > Guido van Rossum added the comment: > > This really is a feature request -- in Python 2.x there is no formatting > code for complex numbers at all, and "%.5s" % complex(...) does the same > thing. > > I agree it would be neat to have control over complex numbers using the > same formatting language used for floats; but I note that it's easy > enough to do this manually, e.g. > > >>> "{0.real:.5}+{0.imag:.5}j".format(z) > > '1+0.7j' That's not quite right because it doesn't always handle the sign correctly and doesn't force float output. So I think it should be this: '1.0+0.7j' >>> "{0.real:.5f}{0.imag:+.5f}j".format(complex(1, -2/3)) '1.0-0.7j' __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1588> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1601] IDLE not working correctly on Windows (Py30a2/IDLE30a1)
New submission from Mark Summerfield: (1) IDLE starts up on Windows OK, but if I press Alt+F the file menu comes up giant sized (i.e., each menu entry is almost as tall as the screen). (2) If I open a file using Ctrl+O, the Open dialog pops up fine, but when I select a file and click Open, IDLE crashes. Oh, and (no version of) IDLE respects the cursor blink setting on Windows. -- components: IDLE messages: 58486 nosy: mark severity: normal status: open title: IDLE not working correctly on Windows (Py30a2/IDLE30a1) type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1601> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1600] str.format() produces different output on different platforms (Py30a2)
New submission from Mark Summerfield: I don't know if this is a bug, but it is certainly a difference in behavior between platforms: Python 3.0a2 on linux2: >>> "{0:.3e}".format(123.45678901) '1.235e+02' Python 3.0a2 on win32: >>> "{0:.3e}".format(123.45678901) '1.235e+002' It seems to me that str.format() should produce consistent results across platforms, but I don't think the PEP says anything either way. -- components: Interpreter Core messages: 58485 nosy: mark severity: normal status: open title: str.format() produces different output on different platforms (Py30a2) type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1600> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1602] windows console doesn't print utf8 (Py30a2)
New submission from Mark Summerfield: I am not sure if this is a Python bug or simply a limitation of cmd.exe. I am using Windows XP Home. I run cmd.exe with the /u option and I have set my console font to "Lucida Console" (the only TrueType font offered), and I run chcp 65001 to set the utf8 code page. When I run the following program: for x in range(32, 2000): print("{0:5X} {0:c}".format(x)) one blank line is output. But if I do chcp 1252 the program prints up to 7F before hitting a unicode encoding error. This is different behaviour from Python 2.5.1 which (with a suitably modified print line) after chcp 65001 prints up to 7F and then fails with "IOError: [Errno 0] Error". -- components: Unicode, Windows messages: 58487 nosy: mark severity: normal status: open title: windows console doesn't print utf8 (Py30a2) type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1602> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1600] str.format() produces different output on different platforms (Py30a2)
Mark Summerfield added the comment: On 2007-12-12, Guido van Rossum wrote: > Guido van Rossum added the comment: > > Again, a (not unreasonable) feature request. AFAIK %e behaves the same > way. I'm sure if you submitted a patch it would be accepted happily. Unfortunately, I can't---I haven't programmed C in more than a decade, and don't know Python's C API, so I doubt I could write anything in C that would actually work! Nowadays I only program in Python and C++:-) __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1600> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1612] infinite recursion when using collections.Sequence in a recursive function (Py30a2)
New submission from Mark Summerfield: In the attached file there are two tiny functions, flatten1() and flatten2(). There is only one difference between them: flatten1() has the line: if isinstance(x, list): and flatten2() has this line instead: if isinstance(x, collections.Sequence): flatten1() works perfectly in Python 2.5.1 and Python 30a2 (just comment out the flatten2() code). But flatten2() goes into "infinite" recursion in Python 30a2 when trying to flatten list "c". -- components: Interpreter Core files: bug.py messages: 58536 nosy: mark severity: normal status: open title: infinite recursion when using collections.Sequence in a recursive function (Py30a2) type: behavior versions: Python 3.0 Added file: http://bugs.python.org/file8939/bug.py __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1612> __import collections def flatten1(seq): """Returns a list containing all the items in seq with no nested sequences >>> a = [[1, 2], [3, [4, [5, 6], 7], 8], 9, [10, 11], [12]] >>> b =flatten1(a) >>> b [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] >>> flatten1(b) == b True >>> c = [["S"] * 4, ["M"] * 2, "R", "H", ["D"] * 3, "A", "B", "E"] >>> flatten1(c) ['S', 'S', 'S', 'S', 'M', 'M', 'R', 'H', 'D', 'D', 'D', 'A', 'B', 'E'] """ result = [] for x in seq: if isinstance(x, list): result.extend(flatten1(x)) else: result.append(x) return result def flatten2(seq): """Returns a list containing all the items in seq with no nested sequences >>> a = [[1, 2], [3, [4, [5, 6], 7], 8], 9, [10, 11], [12]] >>> b =flatten2(a) >>> b [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] >>> flatten2(b) == b True >>> c = [["S"] * 4, ["M"] * 2, "R", "H", ["D"] * 3, "A", "B", "E"] >>> flatten2(c) ['S', 'S', 'S', 'S', 'M', 'M', 'R', 'H', 'D', 'D', 'D', 'A', 'B', 'E'] """ result = [] for x in seq: if isinstance(x, collections.Sequence): result.extend(flatten2(x)) else: result.append(x) return result if __name__ == "__main__": import doctest doctest.testmod() ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1602] windows console doesn't print utf8 (Py30a2)
Mark Summerfield added the comment: I've looked into this a bit more, and from what I can see, code page 65001 just doesn't work---so it is a Windows problem not a Python problem. A possible solution might be to read/write UTF16 which "managed" Windows applications can do. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1602> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1600] str.format() produces different output on different platforms (Py30a2)
Mark Summerfield added the comment: On 2007-12-15, Christian Heimes wrote: > Christian Heimes added the comment: > > Guido is right. On Linux the system's sprintf() family prints %e, %g and > %f with two or three digits while Windows always uses three digits: > > Linux > >>> "%e" % 1e1 > '1.00e+01' > >>> "%e" % 1e10 > '1.00e+10' > >>> "%e" % 1e100 > '1.00e+100' > > Windows > >>> "%e" % 1e1 > '1.00e+001' > >>> "%e" % 1e10 > '1.00e+010' > >>> "%e" % 1e100 > '1.00e+100' > > The output could be changed in any of the functions: > Objects/floatobject.h:format_double() > Python/pystrtod.c:PyOS_ascii_formatd() > Python/mysnprint.c:PyOS_snprintf() It seems to me that Python should provide consistent results across platforms wherever possible and that this is a gratuitous inconsistency that makes cross-platform testing less convenient than it need be. I'll take a look at those functions next week. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1600> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1600] str.format() produces different output on different platforms (Py30a2)
Mark Summerfield added the comment: On 2007-12-15, Christian Heimes wrote: > Christian Heimes added the comment: > > Mark Summerfield wrote: > > It seems to me that Python should provide consistent results across > > platforms wherever possible and that this is a gratuitous inconsistency > > that makes cross-platform testing less convenient than it need be. > > > > I'll take a look at those functions next week. > > It should be fixed in the trunk and merged into py3k. 2.6 suffers from > the same problem. > > By the way I have another pending patch which adds consistent handling > of "nan" and "inf" on all platforms to float. Hi Christian, I've added some code to pystrtod.c's PyOS_ascii_formatd() function that ensures that the exponent is always at least 3 digits, so long as the buffer passed in has room. Although I have svn access, this was granted to me by Georg Brandl only for doing documentation edits, so I don't feel that I can submit code patches myself---and in any case my C is rusty, so I would prefer my code was peer reviewed anyway. Would you be willing to add the patch for me, assuming you are happy with it? I've attached my modified pystrtod.c and also pystrtod.diff which shows the diff against Python 30a2. My code is at the end of the function all in one lump so it is easy to see what I've done. (I've assumed ANSI C, so have declared some local variables in my code block rather than at the top of the function: start, exponent_digit_count, and zeros; they could all be moved if necessary.) I hope this helps:-) Added file: http://bugs.python.org/file8964/pystrtod.diff Added file: http://bugs.python.org/file8965/pystrtod.c __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1600> __*** Python/pystrtod.c 2007-12-16 18:00:29.0 + --- Python/pystrtod.c.orig 2007-12-16 17:16:30.0 + *** *** 238,270 } } - /* Ensure that the exponent is at least 3 digits, - providing the buffer is large enough for the extra zeros. */ - if (format_char == 'e' || format_char == 'E') { - p = buffer; - while (*p && *p != 'e' && *p != 'E') - ++p; - if (*p && (*(p + 1) == '-' || *(p + 1) == '+')) { - p += 2; - char *start = p; - int exponent_digit_count = 0; - while (*p && isdigit((unsigned char)*p)) { - ++p; - ++exponent_digit_count; - } - int zeros = 3 - exponent_digit_count; - if (exponent_digit_count && zeros > 0 && - p + zeros + exponent_digit_count + 1 - < buffer + buf_len) { - p = start; - memmove(p + zeros, p, exponent_digit_count + 1); - int i = 0; - for (; i < zeros; ++i) - *p++ = '0'; - } - } - } - return buffer; } --- 238,243 /* -*- Mode: C; c-file-style: "python" -*- */ #include #include /* ascii character tests (as opposed to locale tests) */ #define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \ (c) == '\r' || (c) == '\t' || (c) == '\v') #define ISDIGIT(c) ((c) >= '0' && (c) <= '9') #define ISXDIGIT(c) (ISDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) /** * PyOS_ascii_strtod: * @nptr:the string to convert to a numeric value. * @endptr: if non-%NULL, it returns the character after * the last character used in the conversion. * * Converts a string to a #gdouble value. * This function behaves like the standard strtod() function * does in the C locale. It does this without actually * changing the current locale, since that would not be * thread-safe. * * This function is typically used when reading configuration * files or other non-user input that should be locale independent. * To handle input from the user you should normally use the * locale-sensitive system strtod() function. * * If the correct value would cause overflow, plus or minus %HUGE_VAL * is returned (according to the sign of the value), and %ERANGE is * stored in %errno. If the correct value would cause underflow, * zero is returned and %ERANGE is stored in %errno. * If memory allocation fails, %ENOMEM is stored in %errno. * * This function resets %errno before calling strtod() so that * you can reliably detect overflow and underflo
[issue1600] str.format() produces different output on different platforms (Py30a2)
Mark Summerfield added the comment: On 2007-12-15, Christian Heimes wrote: > Christian Heimes added the comment: > > Mark Summerfield wrote: > > It seems to me that Python should provide consistent results across > > platforms wherever possible and that this is a gratuitous inconsistency > > that makes cross-platform testing less convenient than it need be. > > > > I'll take a look at those functions next week. > > It should be fixed in the trunk and merged into py3k. 2.6 suffers from > the same problem. > > By the way I have another pending patch which adds consistent handling > of "nan" and "inf" on all platforms to float. Hi Christian, I made two mistakes (that I know of)---(1) I forgot that 'g' format can produce an exponent string, and (2) I did a wrong calculation to ensure that I didn't overflow the buffer. (Even with those mistakes Python's test_float and test_fpformat passed fine, as did my own tests.) Anyway, here's the fixed and hopefully final block of code. The first correction affects the first if statement, and the second correction affects the third if statement. /* Ensure that the exponent is at least 3 digits, providing the buffer is large enough for the extra zeros. */ if (format_char == 'e' || format_char == 'E' || format_char == 'g' || format_char == 'G') { p = buffer; while (*p && *p != 'e' && *p != 'E') ++p; if (*p && (*(p + 1) == '-' || *(p + 1) == '+')) { p += 2; char *start = p; int exponent_digit_count = 0; while (*p && isdigit((unsigned char)*p)) { ++p; ++exponent_digit_count; } int zeros = 3 - exponent_digit_count; if (exponent_digit_count && zeros > 0 && start + zeros + exponent_digit_count + 1 < buffer + buf_len) { p = start; memmove(p + zeros, p, exponent_digit_count + 1); int i = 0; for (; i < zeros; ++i) *p++ = '0'; } } } I've also attached the complete pystrtod.c file with the corrections. Added file: http://bugs.python.org/file8967/pystrtod.c __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1600> __/* -*- Mode: C; c-file-style: "python" -*- */ #include #include /* ascii character tests (as opposed to locale tests) */ #define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \ (c) == '\r' || (c) == '\t' || (c) == '\v') #define ISDIGIT(c) ((c) >= '0' && (c) <= '9') #define ISXDIGIT(c) (ISDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) /** * PyOS_ascii_strtod: * @nptr:the string to convert to a numeric value. * @endptr: if non-%NULL, it returns the character after * the last character used in the conversion. * * Converts a string to a #gdouble value. * This function behaves like the standard strtod() function * does in the C locale. It does this without actually * changing the current locale, since that would not be * thread-safe. * * This function is typically used when reading configuration * files or other non-user input that should be locale independent. * To handle input from the user you should normally use the * locale-sensitive system strtod() function. * * If the correct value would cause overflow, plus or minus %HUGE_VAL * is returned (according to the sign of the value), and %ERANGE is * stored in %errno. If the correct value would cause underflow, * zero is returned and %ERANGE is stored in %errno. * If memory allocation fails, %ENOMEM is stored in %errno. * * This function resets %errno before calling strtod() so that * you can reliably detect overflow and underflow. * * Return value: the #gdouble value. **/ double PyOS_ascii_strtod(const char *nptr, char **endptr) { char *fail_pos; double val = -1.0; struct lconv *locale_data; const char *decimal_point; size_t decimal_point_len; const char *p, *decimal_point_pos; const char *end = NULL; /* Silence gcc */ assert(nptr != NULL); fail_pos = NULL; locale_data = localeconv(); decimal_point = locale_data->decimal_point; decimal_point_len = strlen(decimal_point); assert(decimal_point_len != 0); decimal_point_pos = NULL; if (decimal_point[0] != '.' ||
[issue1600] str.format() produces different output on different platforms (Py30a2)
Mark Summerfield added the comment: Attached is new version of test_float.py with a few tests to check str.format() with exponents formats, plus a diff. They test that the exponent is always 3 digits and that the case of the e in the format is respected. Added file: http://bugs.python.org/file8969/test_float.diff Added file: http://bugs.python.org/file8970/test_float.py __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1600> __*** test_float.py 2007-12-17 08:33:13.0 + --- test_float.py.orig 2007-12-17 08:25:43.0 + *** *** 139,157 self.assertEqual(format( 1.0, '+f'), '+1.00') self.assertEqual(format(-1.0, '+f'), '-1.00') - self.assertEqual("1.234e+009", "{0:.3e}".format(1.23405e+9)) - self.assertEqual("1.234e-009", "{0:.3e}".format(1.23405e-9)) - self.assertEqual("1.234E+009", "{0:.3E}".format(1.23405e+9)) - self.assertEqual("1.234E-009", "{0:.3E}".format(1.23405e-9)) - self.assertEqual("1.234e+027", "{0:.3e}".format(1.23405e+27)) - self.assertEqual("1.234e-027", "{0:.3e}".format(1.23405e-27)) - self.assertEqual("1.234E+027", "{0:.3E}".format(1.23405e+27)) - self.assertEqual("1.234E-027", "{0:.3E}".format(1.23405e-27)) - self.assertEqual("1.234e+132", "{0:.3e}".format(1.23405e+132)) - self.assertEqual("1.234e-132", "{0:.3e}".format(1.23405e-132)) - self.assertEqual("1.234E+132", "{0:.3E}".format(1.23405e+132)) - self.assertEqual("1.234E-132", "{0:.3E}".format(1.23405e-132)) - # % formatting self.assertEqual(format(-1.0, '%'), '-100.00%') --- 139,144 test_float.py Description: application/python ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1600] str.format() produces different output on different platforms (Py30a2)
Mark Summerfield added the comment: My C is rusty! Attached is new pystrtod.c & diff, this time using memset() instead of looping to padd with zeros. Added file: http://bugs.python.org/file8971/pystrtod.c Added file: http://bugs.python.org/file8972/pystrtod.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1600> __/* -*- Mode: C; c-file-style: "python" -*- */ #include #include /* ascii character tests (as opposed to locale tests) */ #define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \ (c) == '\r' || (c) == '\t' || (c) == '\v') #define ISDIGIT(c) ((c) >= '0' && (c) <= '9') #define ISXDIGIT(c) (ISDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) /** * PyOS_ascii_strtod: * @nptr:the string to convert to a numeric value. * @endptr: if non-%NULL, it returns the character after * the last character used in the conversion. * * Converts a string to a #gdouble value. * This function behaves like the standard strtod() function * does in the C locale. It does this without actually * changing the current locale, since that would not be * thread-safe. * * This function is typically used when reading configuration * files or other non-user input that should be locale independent. * To handle input from the user you should normally use the * locale-sensitive system strtod() function. * * If the correct value would cause overflow, plus or minus %HUGE_VAL * is returned (according to the sign of the value), and %ERANGE is * stored in %errno. If the correct value would cause underflow, * zero is returned and %ERANGE is stored in %errno. * If memory allocation fails, %ENOMEM is stored in %errno. * * This function resets %errno before calling strtod() so that * you can reliably detect overflow and underflow. * * Return value: the #gdouble value. **/ double PyOS_ascii_strtod(const char *nptr, char **endptr) { char *fail_pos; double val = -1.0; struct lconv *locale_data; const char *decimal_point; size_t decimal_point_len; const char *p, *decimal_point_pos; const char *end = NULL; /* Silence gcc */ assert(nptr != NULL); fail_pos = NULL; locale_data = localeconv(); decimal_point = locale_data->decimal_point; decimal_point_len = strlen(decimal_point); assert(decimal_point_len != 0); decimal_point_pos = NULL; if (decimal_point[0] != '.' || decimal_point[1] != 0) { p = nptr; /* Skip leading space */ while (ISSPACE(*p)) p++; /* Skip leading optional sign */ if (*p == '+' || *p == '-') p++; while (ISDIGIT(*p)) p++; if (*p == '.') { decimal_point_pos = p++; while (ISDIGIT(*p)) p++; if (*p == 'e' || *p == 'E') p++; if (*p == '+' || *p == '-') p++; while (ISDIGIT(*p)) p++; end = p; } else if (strncmp(p, decimal_point, decimal_point_len) == 0) { /* Python bug #1417699 */ *endptr = (char*)nptr; errno = EINVAL; return val; } /* For the other cases, we need not convert the decimal point */ } /* Set errno to zero, so that we can distinguish zero results and underflows */ errno = 0; if (decimal_point_pos) { char *copy, *c; /* We need to convert the '.' to the locale specific decimal point */ copy = (char *)PyMem_MALLOC(end - nptr + 1 + decimal_point_len); if (copy == NULL) { if (endptr) *endptr = (char *)nptr; errno = ENOMEM; return val; } c = copy; memcpy(c, nptr, decimal_point_pos - nptr); c += decimal_point_pos - nptr; memcpy(c, decimal_point, decimal_point_len); c += decimal_point_len; memcpy(c, decimal_point_pos + 1, end - (decimal_point_pos + 1)); c += end - (decimal_point_pos + 1); *c = 0; val = strtod(copy, &fail_pos); if (fail_pos) { if (fail_pos > decimal_point_pos) fail_pos = (char *)nptr + (fail_pos - copy) - (decimal_point_len - 1); else fail_pos = (char *)nptr + (fail_pos - copy); } PyMem_FREE(copy); } else { unsigned i = 0; if (nptr[i] == '-') i++; if (nptr[i] == '0' && (nptr[i+1] == 'x' || nptr[i+1] == 'X')) fail_pos = (char*)nptr; else val = strtod(nptr, &fail_pos); } if (endptr) *endptr = fail_pos; return val; } /** * PyOS_ascii_formatd: * @buffer: A buffer to place the resulting string in * @buf_len: The length of the buffer. * @format: The printf()-style format to use for the * code to use for converting. * @d: The #gdouble to convert * * Converts a #gdouble to a string, using the '.' as * decimal point. To format the number you pass in * a printf
[issue1600] str.format() produces different output on different platforms (Py30a2)
Mark Summerfield added the comment: On 2007-12-17, Christian Heimes wrote: > Christian Heimes added the comment: > > Hi Mark! > > In general the patch is fine but it has some small issues. > > * Your patches are all reversed. They remove (-) the new lines instead > of adding (+) them. Why aren't you using svn diff > file.patch? I didn't know about that. Have now used it. > * You are mixing tabs with spaces. All 2.6 C files and most 3.0 C files > are still using tabs. Okay, have now switched to tabs. > * You forgot about %f. For large values the format characters f and F > are using the exponent display, too "%f" % 1e60 == '1e+60' Good point; I now search for 'e' or 'E' in any number. > * You cannot assume that char is unsigned. Use Py_CHARMAP(char) instead. > I think that you can make the code more readable when you do format_char > = tolower(Py_CHARMAP(format_char)); first. I don't refer to format_char any more. > * The code is not C89 conform. The standards dictate that you cannot > declare a var in the middle of a block. New var must be declared right > after the { I didn't know that. I've now moved the variable declarations. I've attached the diff you asked for, plus a diff for the test_float.py file -- and I've done the changes in relation to 2.6 trunk since there's nothing 3.0-specific. Hope this is now okay. Added file: http://bugs.python.org/file8983/pystrtod.c.diff Added file: http://bugs.python.org/file8984/test_float.py.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1600> __Index: Python/pystrtod.c === --- Python/pystrtod.c (revision 59545) +++ Python/pystrtod.c (working copy) @@ -238,6 +238,30 @@ } } + /* Ensure that the exponent is at least 3 digits, + providing the buffer is large enough for the extra zeros. */ + p = buffer; + while (*p && *p != 'e' && *p != 'E') + ++p; + if (*p && (*(p + 1) == '-' || *(p + 1) == '+')) { + char *start = p + 2; + int exponent_digit_count = 0; + int zeros = 0; + p += 2; + while (*p && isdigit((unsigned char)*p)) { + ++p; + ++exponent_digit_count; + } + zeros = 3 - exponent_digit_count; + if (exponent_digit_count && zeros > 0 && + start + zeros + exponent_digit_count + 1 + < buffer + buf_len) { + p = start; + memmove(p + zeros, p, exponent_digit_count + 1); + memset(p, '0', zeros); + } + } + return buffer; } Index: Lib/test/test_float.py === --- Lib/test/test_float.py (revision 59545) +++ Lib/test/test_float.py (working copy) @@ -129,12 +129,29 @@ floats_file.close() +class StrFormatETestCase(unittest.TestCase): +def test_str_format_e(self): +self.assertEqual("1.234e+009", "%.3e" %1.23405e+9) +self.assertEqual("1.234e-009", "%.3e" %1.23405e-9) +self.assertEqual("1.234E+009", "%.3E" %1.23405e+9) +self.assertEqual("1.234E-009", "%.3E" %1.23405e-9) +self.assertEqual("1.234e+027", "%.3e" %1.23405e+27) +self.assertEqual("1.234e-027", "%.3e" %1.23405e-27) +self.assertEqual("1.234E+027", "%.3E" %1.23405e+27) +self.assertEqual("1.234E-027", "%.3E" %1.23405e-27) +self.assertEqual("1.234e+132", "%.3e" %1.23405e+132) +self.assertEqual("1.234e-132", "%.3e" %1.23405e-132) +self.assertEqual("1.234E+132", "%.3E" %1.23405e+132) +self.assertEqual("1.234E-132", "%.3E" %1.23405e-132) + + def test_main(): test_support.run_unittest( FormatFunctionsTestCase, UnknownFormatTestCase, IEEEFormatTestCase, -#ReprTestCase +#ReprTestCase, +StrFormatETestCase, ) if __name__ == '__main__': ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1920] while else loop seems to behave incorrectly
New submission from Mark Summerfield: I am using: Python 3.0a2 (r30a2:59382, Dec 17 2007, 08:47:22) [GCC 4.1.2 20070626 (Red Hat 4.1.2-13)] on linux2 IDLE 3.0a1 This seems wrong: >>> while False: print("no") else: print("yes") >>> I expected it to print "yes" because the docs say that the else suite is executed if present and if the loop terminated normally (no break), and this is the case here. This works though: >>> x = False >>> while x: print("no") else: print("yes") yes >>> So it seems that "while False" and "while variable" are giving different behaviour. -- components: Interpreter Core messages: 61629 nosy: mark severity: normal status: open title: while else loop seems to behave incorrectly type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1920> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1600] str.format() produces different output on different platforms (Py30a2)
Mark Summerfield added the comment: On 2008-02-18, Mark Dickinson wrote: > Mark Dickinson added the comment: > > I know I'm coming a bit late to this discussion, but I wanted to point > out that the C99 standard does actually specify how many digits should > be in the exponent of a "%e"-formatted number: > > In section 7.19.6, in the documentation for fprintf, it says: > > "The exponent always contains at least two digits, and only as many more > digits as necessary to represent the exponent." > > Not that that's necessarily a reason for Python to do the same :) I don't really see why Python shouldn't use as few digits as are needed:-) The patch I submitted just made the exponent at least three digits. But my aim was cross-platform consistency, and I still think (whether using the fewest digits, the fewest but at least 2, or whatever other logic) that the same logic should be used on all platforms since this makes it easier to test cross-platform applications that output numbers in exponential form. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1600> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2219] Py30a3: Possibly confusing message when module detection fails
New submission from Mark Summerfield: On Fedora 8 I get this message: Failed to find the necessary bits to build these modules: _bsddb To find the necessary bits, look in setup.py in detect_modules() for the module's name. On Kubuntu 6.06 LTS I get the same message, but about different modules: _hashlib _ssl bz2 In previous versions when headers or libraries couldn't be found I thought the correct file to change was Modules/Setup or Modules/Setup.local. If this is still the case then the above error message should perhaps be changed? BTW For Fedora 8, bsddb won't work since according to Modules/Setup the most recent version supported is 4.0 while Fedora 8 has 4.4. -- components: Build messages: 63202 nosy: mark severity: normal status: open title: Py30a3: Possibly confusing message when module detection fails versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2219> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2219] Py30a3: Possibly confusing message when module detection fails
Mark Summerfield added the comment: On 2008-03-03, Martin v. Löwis wrote: > Martin v. Löwis added the comment: > > Modules/Setup is out of date; _bsddb supports anything between 3.3 and 4.5. > FYI, only now I've just realised that Fedora 8's db version is 4.6.21, but I thought I'd try it anyway. % locate db-4.6 /lib/libdb-4.6.so /usr/lib/libdb-4.6.a /usr/lib/libdb-4.6.la /usr/lib/libdb-4.6.so % ls -l /usr/include/db.h lrwxrwxrwx 1 root root 8 2008-01-10 14:57 /usr/include/db.h -> db4/db.h I edited Modules/Setup as follows: DB=/usr DBLIBVER=4.6 DBINC=$(DB)/include DBLIB=$(DB)/lib _bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER) The last gcc call is this: gcc -pthread -Xlinker -export-dynamic -o python \ Modules/python.o \ libpython3.0.a -lpthread -ldl -lutil -L/usr/lib -ldb-4.6 -lm running build running build_ext Failed to find the necessary bits to build these modules: _bsddb I can't see the DB -I or -L lines but I'm no makefile expert so maybe they come from somewhere else. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2219> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2219] Py30a3: Possibly confusing message when module detection fails
Mark Summerfield added the comment: On 2008-03-03, Martin v. Löwis wrote: > Martin v. Löwis added the comment: > > Rereading your report, I cannot quite understand what issue specifically > you are reporting. What error message do you find confusing, and what do > you think should it say instead? What I find confusing is: Failed to find the necessary bits to build these modules: To find the necessary bits, look in setup.py in detect_modules() for the module's name. I find it confusing because AFAIK if a module can't be built it usually means that you should change the Modules/Setup file and not setup.py itself. (My impression is that the message is aimed at Python developers rather than Python users.) If Modules/Setup is still the correct file for users to edit perhaps the message should be something like: Failed to find the necessary bits to build these modules: If you want these modules and they are on your system, try editing Modules/Setup to be able to find them. > In any case, it is deliberate that db 4.6 is not supported - that > release doesn't really work. OK. (But that is a pity since a lot of people use Fedora 8.) __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2219> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2221] Py30a3: calltip produces error output to stderr
New submission from Mark Summerfield: In IDLE for Py30a3 if you enter: >>> class A( as soon as you type the ( you get the following output to stderr (on Fedora 8 with Tcl/Tk 8.4): : *** Internal Error: rpc.py:SocketIO.localcall() Object: exec Method: > Args: ('A',) Traceback (most recent call last): File "/home/mark/opt/python30a3/lib/python3.0/idlelib/rpc.py", line 188, in localcall ret = method(*args, **kwargs) File "/home/mark/opt/python30a3/lib/python3.0/idlelib/run.py", line 316, in get_the_calltip return self.calltip.fetch_tip(name) File "/home/mark/opt/python30a3/lib/python3.0/idlelib/CallTips.py", line 103, in fetch_tip entity = self.get_entity(name) File "/home/mark/opt/python30a3/lib/python3.0/idlelib/CallTips.py", line 112, in get_entity return eval(name, namespace) SystemError: error return without exception set It does not appear to affect IDLE's functionality. -- components: IDLE messages: 63209 nosy: mark severity: minor status: open title: Py30a3: calltip produces error output to stderr versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2221> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2219] Py30a3: Possibly confusing message when module detection fails
Mark Summerfield added the comment: On 2008-03-03, Martin v. Löwis wrote: > Martin v. Löwis added the comment: > > What I find confusing is: > > > > Failed to find the necessary bits to build these modules: > > > > To find the necessary bits, look in setup.py in detect_modules() for the > > module's name. > > > > I find it confusing because AFAIK if a module can't be built it usually > > means that you should change the Modules/Setup file and not setup.py > > itself. (My impression is that the message is aimed at Python developers > > rather than Python users.) > > No, not at all. If you see that message, it usually means you are on > a Linux system, and you have forgotten to install the header files > for the library the module relies on. You need to look into setup.py > to find out what those header files are, and install them. Changing > Modules/Setup won't help at all, as you don't *have* the header > files. Then why isn't the message something like: Failed to find the necessary bits to build these modules: To find the necessary bits, look in setup.py in detect_modules() for the module's name and the header files it requires. [snip] > >> In any case, it is deliberate that db 4.6 is not supported - that > >> release doesn't really work. > > > > OK. (But that is a pity since a lot of people use Fedora 8.) > > Please complain to Oracle. I thought it was owned by Berkeley University... oh well. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2219> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2278] [Py30a3] xml.parsers.expat recognizes encoding="utf-8" but not encoding="utf8"
New submission from Mark Summerfield <[EMAIL PROTECTED]>: Here is how to reproduce the bug: from xml.etree.ElementTree import parse import io xml1 = """ text""" xml2 = """ text""" f1 = io.StringIO(xml1) f2 = io.StringIO(xml2) tree2 = parse(f2) # this uses "utf-8" and works fine tree1 = parse(f1) Traceback (most recent call last): File "", line 1, in tree1 = parse(f1) File "/home/mark/opt/python30a3/lib/python3.0/xml/etree/ElementTree.py", line 823, in parse tree.parse(source, parser) File "/home/mark/opt/python30a3/lib/python3.0/xml/etree/ElementTree.py", line 561, in parse parser.feed(data) File "/home/mark/opt/python30a3/lib/python3.0/xml/etree/ElementTree.py", line 1201, in feed self._parser.Parse(data, 0) xml.parsers.expat.ExpatError: unknown encoding: line 1, column 30 -- messages: 63471 nosy: mark severity: normal status: open title: [Py30a3] xml.parsers.expat recognizes encoding="utf-8" but not encoding="utf8" versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2278> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2283] lambda *a, **k: a, k # does not work
New submission from Mark Summerfield <[EMAIL PROTECTED]>: According to the docs lambda can handle the same parameter list as can def. But this does not appear to be the case as the following (both 2.5.1 and 30a3) shows: >>> def f(*a, **kw): return a, kw >>> f(1,2,a=3,b=4) ((1, 2), {'a': 3, 'b': 4}) >>> A = lambda *a: a >>> A(1,2) (1, 2) >>> K = lambda **k: k >>> K(a=1,b=2) {'a': 1, 'b': 2} >>> X = lambda *a, **k: a, k Traceback (most recent call last): File "", line 1, in X = lambda *a, **k: a, k NameError: name 'k' is not defined So either this is an interpreter bug, or a doc bug. -- components: Interpreter Core messages: 63499 nosy: mark severity: normal status: open title: lambda *a, **k: a, k # does not work versions: Python 2.5, Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2283> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2283] lambda *a, **k: a, k # does not work
Changes by Mark Summerfield <[EMAIL PROTECTED]>: -- type: -> behavior __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2283> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2278] [Py30a3] xml.parsers.expat recognizes encoding="utf-8" but not encoding="utf8"
Changes by Mark Summerfield <[EMAIL PROTECTED]>: -- components: +Library (Lib), XML type: -> behavior __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2278> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2283] lambda *a, **k: a, k # does not work
Mark Summerfield <[EMAIL PROTECTED]> added the comment: On 2008-03-13, Imri Goldberg wrote: > Imri Goldberg <[EMAIL PROTECTED]> added the comment: > > This is not a bug, just missing parenthesis. > > >>> lambda x: x,x > > Traceback (most recent call last): > File "", line 1, in > NameError: name 'x' is not defined > > >>> lambda x: (x,x) > > at 0x8293e2c> Yes, sorry. (But I don't seem to have the ability to make the bug resolved or deleted.) __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2283> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2278] [Py30a3] xml.parsers.expat recognizes encoding="utf-8" but not encoding="utf8"
Mark Summerfield <[EMAIL PROTECTED]> added the comment: You're right that the parser should not recognise "utf8" since it isn't correct XML (as per the references you gave). I made the mistake because I used the etree module and wrote an XML file with encoding "utf8" which etree accepted. I've now switched to using "UTF-8". __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2278> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2219] Py30a3: Possibly confusing message when module detection fails
Mark Summerfield <[EMAIL PROTECTED]> added the comment: On 2008-03-20, Sean Reifschneider wrote: > Sean Reifschneider <[EMAIL PROTECTED]> added the comment: > > Don't modify Modules/Setup*, do as the message says and modify setup.py. > Search for "4, 5", and change that to "4, 6", then run configure and > make and it will build without this message. I did as you said and it worked perfectly. Thanks! > I have done this against the py3k trunk and it built properly and did > not display this message, so I think the current message is correct. Yes you're right---it was just a bit surprising because in the past it has always been Modules/Setup that needed fixing. > As far as the bsddb 4.6 being broken, I spoke to Gregory and Martin and > the story is that it is broken on some platforms, and isn't enabled by > default because doing so breaks our buildbots on those platforms. > > I wouldn't expect the problem from F8 version, if nothing else because > it's probably not a stock version, it's likely patched to the issues > that Gregory has seen, if they impact F8. So presumably the Fedora maintainers will do the setup.py fix you suggested. Thanks! __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2219> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2494] Can't round-trip datetimes<->timestamps prior to 1970 on Windows
New submission from Mark Summerfield <[EMAIL PROTECTED]>: # If you run the code below on Py30a3 you get the output shown at the end import calendar, datetime, time pastdate = datetime.datetime(1969, 12, 31) print(pastdate) timestamp = calendar.timegm(pastdate.utctimetuple()) print(timestamp) try: pastdate_x = datetime.datetime.utcfromtimestamp(timestamp) except ValueError as err: print("FAIL", err) try: print(time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime(timestamp))) except ValueError as err: print("FAIL", err) r""" Python 30a3 Windows output: 1969-12-31 00:00:00 -86400 FAIL timestamp out of range for platform localtime()/gmtime() function FAIL (22, 'Invalid argument') Linux output: 1969-12-31 00:00:00 -86400 1969-12-31T00:00:00 """ # What this appears to show is that you can't round-trip between datetimes and timestamps on Windows for dates prior to 1970 -- components: Library (Lib) messages: 64578 nosy: mark severity: normal status: open title: Can't round-trip datetimes<->timestamps prior to 1970 on Windows type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2494> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2501] xml.sax.parser() doesn't terminate when given a filename
New submission from Mark Summerfield <[EMAIL PROTECTED]>: The tiny program at the end of this message runs under Python 2.5 & 30a3. Under 2 it gives the following output: : python sax.py test.xml ('+', u'document') ('+', u'outer') ('+', u'inner') ('-', u'inner') ('-', u'outer') ('-', u'document') Done Under 3 it does not terminate: : python3 sax.py test.xml + document + outer + inner - inner - outer - document Traceback (most recent call last): File "sax.py", line 19, in parser.parse(sys.argv[1]) File "/home/mark/opt/python30a3/lib/python3.0/xml/sax/expatreader.py", line 107, in parse xmlreader.IncrementalParser.parse(self, source) File "/home/mark/opt/python30a3/lib/python3.0/xml/sax/xmlreader.py", line 124, in parse buffer = file.read(self._bufsize) File "/home/mark/opt/python30a3/lib/python3.0/io.py", line 774, in read current = self.raw.read(to_read) KeyboardInterrupt The xml.sax.parser() function seems to work fine if you give it an open file object and close the file after the call. But the documentation says you can give it a filename, but if you do that the parser does not terminate in Python 3 although it works fine in Python 2. # sax.py import sys import xml.sax BUG = True class SaxHandler(xml.sax.handler.ContentHandler): def startElement(self, name, attributes): print("+", name) def endElement(self, name): print("-", name) handler = SaxHandler() parser = xml.sax.make_parser() parser.setContentHandler(handler) if BUG: parser.parse(sys.argv[1]) else: fh = open(sys.argv[1], encoding="utf8") parser.parse(fh) fh.close() print("Done") # end of sax.py Here is the test file: -- components: XML messages: 64625 nosy: mark severity: normal status: open title: xml.sax.parser() doesn't terminate when given a filename type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2501> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2526] str.format() :n format does not appear to work
New submission from Mark Summerfield <[EMAIL PROTECTED]>: >>> # Py30a3 >>> import locale >>> locale.setlocale(locale.LC_ALL, "en_US.UTF8") 'en_US.UTF8' >>> locale.format("%d", 12345, True) '12,345' >>> "{0:n}".format(12345) '12345' According to the docs the 'n' format should use the locale-dependent separator, so I expected both strings to be '12,345'. Also, it is a pity that locale.format() uses the old deprecated % syntax rather than the much nicer and better str.format() syntax. -- components: Interpreter Core messages: 64804 nosy: mark severity: normal status: open title: str.format() :n format does not appear to work type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2526> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2547] Py30a4 RELNOTES only cover 30a1 and 30a2
New submission from Mark Summerfield <[EMAIL PROTECTED]>: The 30a4 RELNOTES file doesn't cover 30a3 or 30a4. -- assignee: georg.brandl components: Documentation messages: 64918 nosy: georg.brandl, mark severity: normal status: open title: Py30a4 RELNOTES only cover 30a1 and 30a2 type: feature request versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2547> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2606] trace module crashes due to using wrong sort idiom
New submission from Mark Summerfield <[EMAIL PROTECTED]>: In Py30a4's trace.py there is this: calls = self.calledfuncs.keys() calls.sort() which causes: AttributeError: 'dict_keys' object has no attribute 'sort' There are two other occurrences of this idiom in trace.py (just search for ".sort"). I guess they should be easy to fix. -- components: Library (Lib) messages: 65290 nosy: mark severity: normal status: open title: trace module crashes due to using wrong sort idiom type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2606> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2613] inconsistency with bare * in parameter list
New submission from Mark Summerfield <[EMAIL PROTECTED]>: A bare * in a parameter list behaves differently depending on what follows it: Py30a4: >>> def f(*, a=1, b=2): return 1 >>> def g(*, **kwargs): return 1 SyntaxError: named arguments must follow bare * (, line 1) I don't know if this is a bug or not but thought it worth querying. This case does not seem to be mentioned in PEP 3102. -- components: Interpreter Core messages: 65340 nosy: mark severity: normal status: open title: inconsistency with bare * in parameter list type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2613> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2649] poss. patch for fnmatch.py to add {.htm, html} style globbing
New submission from Mark Summerfield <[EMAIL PROTECTED]>: At the moment fnmatch.py (and therefore glob.py) support: * . [chars] [!chars] The attached version of fnmatch.py extends this to: * . [chars] [!chars] {one,two,...} There are 2 changes from the original fnmatch.py file: (1) The documentation for the fnmatch() function has been updated to reflect the new functionality (2) The translate() function has been completely replaced. I ran test_fnmatch.py and test_glob.py and both ran without errors. -- components: Library (Lib) files: fnmatch.py messages: 65584 nosy: mark severity: normal status: open title: poss. patch for fnmatch.py to add {.htm,html} style globbing type: feature request versions: Python 3.0 Added file: http://bugs.python.org/file10047/fnmatch.py __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2649> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2801] Py30a5 float.is_integer() raises ValueError
New submission from Mark Summerfield <[EMAIL PROTECTED]>: The new method float.is_integer() introduced in Py30a5 behaves unexpectedly: >>> x = 5.0 >>> x.as_integer_ratio() (5, 1) >>> x.is_integer() Traceback (most recent call last): File "", line 1, in x.is_integer() ValueError: (11, 'Resource temporarily unavailable') I was expecting True. -- messages: 66465 nosy: mark severity: normal status: open title: Py30a5 float.is_integer() raises ValueError type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2801> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2802] str.format() :n integer output
New submission from Mark Summerfield <[EMAIL PROTECTED]>: In Py30a5 the 'n' format option is not v. useful for integers: >>> for x in range(8): print("{0:n} ".format(10**x), end="") 1 10 100 1,000 10,000 100,000 1e+06 1e+07 This is because it behaves like g once a number grows large. That makes sense for floats, but since Python has unlimited size integers there is currently no built-in way to get, 10**6 to output as 1,000,000 (or using whatever the user's locale-dependent separator is). (It is easy to write a suitable function for this, but it just seems that n is a bit of a teaser in this regard.) I think that n should stay the same for floats, but for integers should never switch to g, but just use as many separators as needed. -- messages: 66471 nosy: mark severity: normal status: open title: str.format() :n integer output type: feature request versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2802> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2801] Py30a5 float.is_integer() raises ValueError
Mark Summerfield <[EMAIL PROTECTED]> added the comment: On 2008-05-09, Mark Dickinson wrote: > Mark Dickinson <[EMAIL PROTECTED]> added the comment: > > Is this on Windows? I can't reproduce it on OS X 10.5.2: > > Python 3.0a5+ (py3k:62937M, May 9 2008, 09:32:27) > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > > >>> x = 5.0 > >>> x.is_integer() > > True I'm on Linux: '3.0a5 (r30a5:62856, May 9 2008, 11:23:06) \n[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)]' >>> (5.).as_integer_ratio() (5, 1) >>> (5.).is_integer() Traceback (most recent call last): File "", line 1, in (5.).is_integer() ValueError: (11, 'Resource temporarily unavailable') (I can't test on Windows because Py30a5 isn't available for it yet.) __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2801> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2802] str.format() :n integer output
Mark Summerfield <[EMAIL PROTECTED]> added the comment: On 2008-05-09, Mark Dickinson wrote: > Mark Dickinson <[EMAIL PROTECTED]> added the comment: > > I think that n should stay the same for floats, but for integers should > > never switch to g, but just use as many separators as needed. > > I agree with this, in principle. It might be some work to implement, > though: for floats, Python gets to use the OS-supplied formatting > functions. Indeed, it looks as though all that happens here is that the > > integer is converted to a float before formatting: > >>> print("{0:n} ".format(10**400), end="") > > Traceback (most recent call last): > File "", line 1, in > OverflowError: Python int too large to convert to C double > > For integers, we'd have to roll our own code. I had similar problems > trying to implement the 'n' format code for Decimal; in the end I just > gave up and left it unimplemented. Maybe using 'n' for an integer should > just raise an exception, for now? > > Eric, what do you think? It isn't hard (in Python): import locale locale.setlocale(locale.LC_ALL, "") separator = locale.localeconv()["thousands_sep"] def n_format(integer, separator): chars = [] for i, char in enumerate(reversed("{0:d}".format(integer))): if i and not i % 3: chars.insert(0, separator) chars.insert(0, char) return "".join(chars) __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2802> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2801] Py30a5 float.is_integer() raises ValueError
Mark Summerfield <[EMAIL PROTECTED]> added the comment: OK, I've just built against your fix and it works fine now! Python 3.0a5+ (py3k:60668:62940, May 9 2008, 15:48:15) [GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> (5.).as_integer_ratio() (5, 1) >>> (5.).is_integer() True __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2801> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2802] str.format() :n integer output
Mark Summerfield <[EMAIL PROTECTED]> added the comment: On 2008-05-09, Eric Smith wrote: > Eric Smith <[EMAIL PROTECTED]> added the comment: > > The reason for this is that 'n' is defined in PEP 3101 as being a float > format only, and the rule is that if an integer sees a float format, it > does a float conversion and then prints the float with the supplied format. > > I'd be okay with adding 'n' as an integer format, with the loose > definition of "just like 'd', but adding thousands separators". > > As to the implementation, the OS supplied float formatting does not add > thousands separators. I added the function add_thousands_grouping() to > Python/pystrtod.c in order implement this for floats. It would be easy > to make this same code work for integers (and in fact it might already > work, although there are probably memory allocation issues to deal with). > > Maybe we should bring up modifying the PEP on python-dev or python-3000. I hope that you do:-) > This issue exists in 2.6 as well. > > -- > components: +Interpreter Core > versions: +Python 2.6 > > __ > Tracker <[EMAIL PROTECTED]> > <http://bugs.python.org/issue2802> > __ __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2802> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1733134] sqlite3.dll cannot be relocated
Mark Summerfield <[EMAIL PROTECTED]> added the comment: Unfortunately, this bug appears to affect Py30a5 too (at least on Win XP Home): Python 3.0a5 (py3k:62932M, May 9 2008, 16:23:11) [MSC v.1500 32 bit (Intel)] on win32 IDLE 3.0a5 >>> import sqlite3 Traceback (most recent call last): File "", line 1, in import sqlite3 File "c:\Python30\lib\sqlite3\__init__.py", line 24, in from sqlite3.dbapi2 import * File "c:\Python30\lib\sqlite3\dbapi2.py", line 27, in from _sqlite3 import * ImportError: DLL load failed: The specified module could not be found. -- nosy: +mark _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1733134> _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2806] Py30a5: Tk Menu Alt-f behaves differently Linux vs Windows
New submission from Mark Summerfield <[EMAIL PROTECTED]>: #Python 3.0a5 (py3k:62932M, May 9 2008, 16:23:11) [MSC v.1500 32 bit #(Intel)] on win32 # # If you run this tiny program on Linux and press Alt+F (Alt-f in Tk # terminology) the File menu pops up as expected. But run it on # Windows Home XP and nothing happens when you press Alt+F. # The problem may be with the code below since IDLE works fine on # Windows, in which case sorry! # However, Grayson's AppB/menu.py example (with suitably fixed print # statements since it was writtend for Py2) is exactly the same: # works fine on Linux but Alt+key does not invoke the menus on Windows. from Tkinter import * class MainWindow: def __init__(self, parent): self.parent = parent menuBar = Frame(self.parent, relief=RAISED, borderwidth=2) menuBar.pack(anchor=N, fill=X) fileMenu = Menubutton(menuBar, text="File", underline=0) fileMenu.pack(side=LEFT) fileMenu.menu = Menu(fileMenu, tearoff=False) for label, command in ( ("New...", self.fileNew), ("Open...", self.fileOpen), ("Quit", self.fileQuit)): fileMenu.menu.add_command(label=label, command=command) fileMenu["menu"] = fileMenu.menu menuBar.tk_menuBar(fileMenu) def fileNew(self, *args): print("fileNew", args) def fileOpen(self, *args): print("fileOpen", args) def fileQuit(self, *args): self.parent.destroy() root = Tk() window = MainWindow(root) root.protocol("WM_DELETE_WINDOW", window.parent.destroy) root.mainloop() -- messages: 66492 nosy: mark severity: normal status: open title: Py30a5: Tk Menu Alt-f behaves differently Linux vs Windows type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2806> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2835] Py30a5: webbrowser.open() inf recursion
New submission from Mark Summerfield <[EMAIL PROTECTED]>: There appears to be an infinite recursion in Py30a5 (doing the same thing in Py2.5.1 works fine): Python 3.0a5 (r30a5:62856, May 9 2008, 11:23:06) [GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2 Type "copyright", "credits" or "license()" for more information. IDLE 3.0a5 >>> import webbrowser >>> url = "http://www.python.org"; >>> webbrowser.open(url) Traceback (most recent call last): File "", line 1, in webbrowser.open(url) File "/home/mark/opt/python30a5/lib/python3.0/webbrowser.py", line 61, in open if browser.open(url, new, autoraise): File "/home/mark/opt/python30a5/lib/python3.0/webbrowser.py", line 350, in open devnull = open(os.devnull, "r+") File "/home/mark/opt/python30a5/lib/python3.0/webbrowser.py", line 61, in open if browser.open(url, new, autoraise): File "/home/mark/opt/python30a5/lib/python3.0/webbrowser.py", line 350, in open ... devnull = open(os.devnull, "r+") File "/home/mark/opt/python30a5/lib/python3.0/webbrowser.py", line 61, in open if browser.open(url, new, autoraise): -- components: Library (Lib) messages: 66716 nosy: mark severity: normal status: open title: Py30a5: webbrowser.open() inf recursion type: behavior versions: Python 3.0 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2835> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2835] Py30a5: webbrowser.open() inf recursion
Mark Summerfield <[EMAIL PROTECTED]> added the comment: I get the same bug on Fedora 8 (Python build 63161) and Kubuntu 8 (official Py30a5 release)---but not on Windows XP Home where the URL is opened correctly. Python 3.0a5+ (py3k:60668:63161, May 12 2008, 14:46:40) [GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import webbrowser >>> webbrowser.open("http://www.python.org";) Traceback (most recent call last): File "", line 1, in File "/home/mark/pycore/30/Lib/webbrowser.py", line 61, in open if browser.open(url, new, autoraise): Python 3.0a5 (r30a5:62856, May 9 2008, 11:27:40) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "copyright", "credits" or "license()" for more information. IDLE 3.0a5 >>> import webbrowser >>> webbrowser.open("http://www.python.org";) Traceback (most recent call last): File "", line 1, in webbrowser.open("http://www.python.org";) ... __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2835> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2835] Py30a5: webbrowser.open() inf recursion
Mark Summerfield <[EMAIL PROTECTED]> added the comment: On 2008-05-12, Amaury Forgeot d'Arc wrote: > Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: > > The traceback suggest a problem when using KDE: a call to file() was > renamed to open(), this clashes with webbrowser.open(). > Can you try the following patch: > > Index: Lib/webbrowser.py > === > --- Lib/webbrowser.py (revision 63159) > +++ Lib/webbrowser.py (working copy) > @@ -347,7 +347,8 @@ > else: > action = "openURL" > > -devnull = open(os.devnull, "r+") > +import io > +devnull = io.open(os.devnull, "r+") > # if possible, put browser in separate process group, so > # keyboard interrupts don't affect browser as well as Python > setsid = getattr(os, 'setsid', None) That fixed it! __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2835> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4630] IDLE no longer respects .Xdefaults insertOffTime
New submission from Mark Summerfield <[EMAIL PROTECTED]>: IDLE's cursor blinks with Python 3.0 on Linux. But it shouldn't (and doesn't for prior versions) because in my .Xdefaults file I have the line: *insertOffTime: 0 Now I have to manually edit idlelib/EditorWindow.py to stop the cursor from blinking. (I also have to do this on Windows because IDLE ignores the blink rate set in the control panel.) I am one of a minority of people who cannot work with blinking cursors. I hope that at the least IDLE will get an option to switch it off. -- components: IDLE messages: 77598 nosy: mark severity: normal status: open title: IDLE no longer respects .Xdefaults insertOffTime versions: Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4630> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4630] IDLE no longer respects .Xdefaults insertOffTime
Mark Summerfield added the comment: Although I stand by my criticism of IDLE not offering the option of switching off cursor blink, I've now discovered that the problem was with Fedora 10 no longer executing xrdb .Xdefaults; once I added that line to my .bash_profile the cursor blinking stopped. However, that is no help to people using Windows for whom the only solution is to manually edit the EditorWindow.py file every time they install a new version of Python. ___ Python tracker <http://bugs.python.org/issue4630> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45480] Missing link(s) to the "Python Module Index" page
New submission from Mark Summerfield : I mostly use the Python 3.8 docs since that's the Python I use. However, when I tried using the 3.9 and 3.10 docs I found that the top of each page has a long search bar (presumably for mobile devices?) but _no_ link to the python module index. I find this last page the most important page for looking things up, so I really hope the 'modules' link is restored. -- assignee: docs@python components: Documentation messages: 403977 nosy: docs@python, mark priority: normal severity: normal status: open title: Missing link(s) to the "Python Module Index" page versions: Python 3.10, Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue45480> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41765] XFCE task switcher shows 'Tk' insteadl of Window title
New submission from Mark Summerfield : This tiny test application illustrates the problem: ```python #!/usr/bin/env python3 import tkinter as tk app = tk.Tk() app.withdraw() app.title('Test App') app.deiconify() app.mainloop() ``` When run on Linux with XFCE the task bar entry shows the text 'Test App', but the task switcher shows 'Tk' rather than the title text. -- components: Tkinter messages: 376745 nosy: mark priority: normal severity: normal status: open title: XFCE task switcher shows 'Tk' insteadl of Window title type: behavior versions: Python 3.6, Python 3.8 ___ Python tracker <https://bugs.python.org/issue41765> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41765] XFCE task switcher shows 'Tk' insteadl of Window title
Mark Summerfield added the comment: I just ran IDLE and it seems to have the same problem. Although the taskbar entry is 'Python 3.6.9 Shell' (ought really to be 'IDLE'), when context switching the switcher shows the correct icon but the title 'Toplevel'. -- ___ Python tracker <https://bugs.python.org/issue41765> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41765] XFCE task switcher shows 'Tk' insteadl of Window title
Mark Summerfield added the comment: Same applied to IDLE for Python 3.8 -- ___ Python tracker <https://bugs.python.org/issue41765> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4198] os.path.normcase gets fooled on windows with mapped linux network drive
Mark Summerfield added the comment: When running a VirtualBox Windows 7 guest on Linux I have found that os.path.samefile() returns False when the filenames are the same, e.g., f = r'V:\pdfs\boson1.pdf' same = os.path.samefile(f, f) print(same) # expected True; got False I mention it here because it may be part of the same problem. I'm using Python 3.7.2. -- nosy: +mark versions: +Python 3.7 -Python 3.3 ___ Python tracker <https://bugs.python.org/issue4198> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15133] tkinter.BooleanVar.get() docstring is wrong
New submission from Mark Summerfield : Python 3.2.2 (default, Jun 4 2012, 11:15:16) [GCC 4.4.5] on linux2 Type "copyright", "credits" or "license()" for more information. >>> from tkinter import * >>> help(BooleanVar.get) Help on function get in module tkinter: get(self) Return the value of the variable as a bool. On my system it actually returns an int. (I wish it did return a bool though.) -- components: Tkinter messages: 163387 nosy: mark priority: normal severity: normal status: open title: tkinter.BooleanVar.get() docstring is wrong versions: Python 3.2 ___ Python tracker <http://bugs.python.org/issue15133> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15133] tkinter.BooleanVar.get() behavior and docstring disagree
Mark Summerfield added the comment: Did you mean formal test code? Or just an example like this: from tkinter import * tk = Tk() bv = BooleanVar() print(bv.get(), type(bv.get())) bv.set(True) print(bv.get(), type(bv.get())) bv.set(False) print(bv.get(), type(bv.get())) ### output ### 0 1 0 -- ___ Python tracker <http://bugs.python.org/issue15133> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15133] tkinter.BooleanVar.get() behavior and docstring disagree
Mark Summerfield added the comment: I think that BooleanVar.set(x) should do bool(x) on its argument (and raise an exception if this isn't valid) and BooleanVar.get() should return a bool. Similarly I think that IntVar.set(x) should do int(x) and IntVar.get() should return an int, and that DoubleVar.set(x) should do float(x) and should return a float. I will mention this issue on tkinter-discuss and encourage people to comment. -- ___ Python tracker <http://bugs.python.org/issue15133> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15133] tkinter.BooleanVar.get() behavior and docstring disagree
Mark Summerfield added the comment: Oh, and I forgot to say that I think StringVar.set(x) should do str(x) and StringVar.get() should return a str. -- ___ Python tracker <http://bugs.python.org/issue15133> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15133] tkinter.BooleanVar.get() behavior and docstring disagree
Mark Summerfield added the comment: How about a compromise? Deprecate (but keep BooleanVar) and add BoolVar with proper True/False behavior to match the other *Vars? -- ___ Python tracker <http://bugs.python.org/issue15133> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15189] tkinter.messagebox does not use the application's icon
New submission from Mark Summerfield : The tkinter.messagebox functions, e.g., askyesno(), do not use the application's icon (if it has one). Nor do they accept a bitmapicon option, so ISTM that it is "impossible" to set one. The same is true of tkinter.dialog, but for that it is easy enough to write one's own replacement with the code like this: try: tkinter._default_root.iconbitmap(iconName) except tk.TclError as err: print(err) (where iconName is "path/to/icon.ico" on windows, "@path/to/icon.xbm" on Unix; and this isn't done on Mac). -- components: Tkinter messages: 164053 nosy: mark priority: normal severity: normal status: open title: tkinter.messagebox does not use the application's icon versions: Python 3.2 ___ Python tracker <http://bugs.python.org/issue15189> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15191] tkinter convenience dialogs don't use themed widgets
New submission from Mark Summerfield : Some of the tkinter convenience dialogs, e.g., tkinter.filedialog.FileDialog, tkinter.scrolledtext.ScrolledText, tkinter.simpledialog.SimpleDialog, tkinter.simpledialog.Dialog, and tkinter.simpledialog._QueryDialog. Ideally they should use ttk.Frame, ttk.Button, etc. Or if that is risky for compatibility, then couldn't they be copied to tkinter.ttk and the copies themized? -- components: Tkinter messages: 164057 nosy: mark priority: normal severity: normal status: open title: tkinter convenience dialogs don't use themed widgets versions: Python 3.2 ___ Python tracker <http://bugs.python.org/issue15191> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15189] tkinter.messagebox does not use the application's icon
Mark Summerfield added the comment: On Linux & Windows every top-level window (including dialogs) normally has an icon at the left of the title bar. Typically this icon is the application's icon. But tkinter doesn't provide such an icon and so a system default icon is used instead. For one's own code this can be fixed by using the iconbitmap() function, but for the tkinter convenience dialogs (e.g., askyesno()), this cannot be done. So, my suggestion is to make the convenience dialogs use the same icon as the application (if the application has one). -- ___ Python tracker <http://bugs.python.org/issue15189> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3405] Add support for the new data option supported by event generate (Tk 8.5)
Mark Summerfield added the comment: According to the Tcl/Tk docs the 'data' field is a string (i.e., for any user data) and the 'detail' field contains some internal data (so shouldn't be messed with); see http://www.tcl.tk/man/tcl8.5/TkCmd/event.htm#M16 Anyway, I hope you add a data field for user created virtual events. -- nosy: +mark ___ Python tracker <http://bugs.python.org/issue3405> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com